Submission #171281

#TimeUsernameProblemLanguageResultExecution timeMemory
171281Su1tanPreokret (COCI18_preokret)C++14
6.80 / 50
4 ms504 KiB
#include <bits/stdc++.h> using namespace std; #define sz size #define pb push_back const int N = 3e3 + 123; int n, m, a, b, ans1, ans, l; map <int, bool> team; vector <int> v; int main() { //freopen("input.txt", "r", stdin); cin >> n; for(int i = 1; i <= n; ++i) { int k; cin >> k; v.pb(k); if(k <= 1440) ++ans1; team[k] = 0; } cin >> m; for(int i = 1; i <= m; ++i) { int k; cin >> k; if(k <= 1440) ++ans1; v.pb(k); team[k] = 1; } cout << ans1 << "\n"; if(!team[v[0]]) { l = 1; ++a; } else { l = 0; ++b; } sort(v.begin(), v.end()); for(int i = 1; i < v.sz(); ++i) { if(!team[v[i]]) ++a; else ++b; if(a > b && l == 1 && b != 0) { l = 0; ++ans; } if(a < b && l == 0 && a != 0) { l = 1; ++ans; } } cout << ans; }

Compilation message (stderr)

preokret.cpp: In function 'int main()':
preokret.cpp:40:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < v.sz(); ++i) {
                 ~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...