fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <utility>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. vector<pair<int,string>> aye[101];
  8.  
  9. int main() {
  10. int n,m,i,a,b;
  11. string x;
  12. cin >> n >> m;
  13.  
  14. for (int i = 1; i <= n; ++i) {
  15. cin >> x;
  16. cin >> a >> b;
  17. aye[a].push_back(make_pair(-b,x));
  18. cout << aye[a].back().first << aye[a].back().second;
  19. }
  20. }
Success #stdin #stdout 0s 3420KB
stdin
2
0
Hello
0
1
World
1
2
stdout
-1Hello-2World