Submission #1019189

#TimeUsernameProblemLanguageResultExecution timeMemory
1019189codefoxPalembang Bridges (APIO15_bridge)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { int k, n; cin >> k >> n; vector<pii> jobs; vector<int> pos; int sol = 0; for (int i = 0; i < n; i++) { char c1, c2; int a, b; cin >> c1 >> a >> c2 >> b; if (c1!=c2) { jobs.push_back(a, b); pos.push_back(a); pos.push_back(b); } else sol += abs(a-b); } sort(pos.begin(), pos.end()); if (k == 1) { int h = pos[pos.size()/2]; for (int ele:pos) sol += abs(ele-h); cout << sol+pos.size()/2; } return 0; }

Compilation message (stderr)

bridge.cpp: In function 'int main()':
bridge.cpp:9:12: error: 'pii' was not declared in this scope
    9 |     vector<pii> jobs;
      |            ^~~
bridge.cpp:9:15: error: template argument 1 is invalid
    9 |     vector<pii> jobs;
      |               ^
bridge.cpp:9:15: error: template argument 2 is invalid
bridge.cpp:19:18: error: request for member 'push_back' in 'jobs', which is of non-class type 'int'
   19 |             jobs.push_back(a, b);
      |                  ^~~~~~~~~