Submission #1364236

#TimeUsernameProblemLanguageResultExecution timeMemory
1364236avahwA String Problem (EGOI25_stringproblem)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<pair<int>> strings(n);
    for(int i = 0; i < n; i++){
        cin >> strings[i].first >> strings[i].second;
    }
    sort(strings.begin(), strings.end());
    int restrings = n - 1;
    if(n % 2 == 0) restrings--;
    cout << restrings << "\n";
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:17: error: wrong number of template arguments (1, should be 2)
    9 |     vector<pair<int>> strings(n);
      |                 ^~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from Main.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
  187 |     struct pair
      |            ^~~~
Main.cpp:9:20: error: template argument 1 is invalid
    9 |     vector<pair<int>> strings(n);
      |                    ^~
Main.cpp:9:20: error: template argument 2 is invalid
Main.cpp:11:23: error: invalid types 'int[int]' for array subscript
   11 |         cin >> strings[i].first >> strings[i].second;
      |                       ^
Main.cpp:11:43: error: invalid types 'int[int]' for array subscript
   11 |         cin >> strings[i].first >> strings[i].second;
      |                                           ^
Main.cpp:13:18: error: request for member 'begin' in 'strings', which is of non-class type 'int'
   13 |     sort(strings.begin(), strings.end());
      |                  ^~~~~
Main.cpp:13:35: error: request for member 'end' in 'strings', which is of non-class type 'int'
   13 |     sort(strings.begin(), strings.end());
      |                                   ^~~