Submission #979088

#TimeUsernameProblemLanguageResultExecution timeMemory
979088Sandarach151Med (COCI22_med)C++17
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<int, string> > score(n); vector<pair<int, string> > arr(n); for(int i=0; i<n; i++){ cin >> score[i].second; score[i].first = 0; for(int j=0; j<5; j++){ int a; cin >> a; score[i].first -= a; } arr[i] = score[i]; } sort(score.begin(), score.end()); for(int i=0; i<n; i++){ int minpos = lower_bound(score.begin(), score.end(), make_pair(arr[i].first-500, arr[i].second))-score.begin(); int maxpos = lower_bound(score.begin(), score.end(), make_pair(arr[i].first+500, arr[i].second))-score.begin(); cout << minpos+1 << ' ' << maxpos << '\n'; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:5: error: 'vector' was not declared in this scope
    9 |     vector<pair<int, string> > score(n);
      |     ^~~~~~
Main.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
Main.cpp:9:30: error: expected primary-expression before '>' token
    9 |     vector<pair<int, string> > score(n);
      |                              ^
Main.cpp:9:32: error: 'score' was not declared in this scope
    9 |     vector<pair<int, string> > score(n);
      |                                ^~~~~
Main.cpp:10:30: error: expected primary-expression before '>' token
   10 |     vector<pair<int, string> > arr(n);
      |                              ^
Main.cpp:10:32: error: 'arr' was not declared in this scope
   10 |     vector<pair<int, string> > arr(n);
      |                                ^~~
Main.cpp:21:5: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   21 |     sort(score.begin(), score.end());
      |     ^~~~
      |     qsort