Submission #1093003

#TimeUsernameProblemLanguageResultExecution timeMemory
1093003kemInfinite Race (EGOI24_infiniterace2)C++14
100 / 100
19 ms2652 KiB
#include <bits/stdc++.h> using namespace std; #define NAME "name" #define ll long long #define pb push_back #define pii pair<int, int> #define fi first #define se second #define endl "\n" #define sz(v) (int)(v).size() #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() const int LIM = 2e5 + 3; const int INF = 1e9; const int mod = 1e9 + 7; int n, q; int cnt[LIM], maxes = 0; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (ifstream(NAME ".inp")) { freopen(NAME ".inp", "r", stdin); freopen(NAME ".out", "w", stdout); } cin >> n >> q; memset(cnt, -1, sizeof(cnt)); for (int i = 1; i <= q; i++) { int x; cin >> x; if (x > 0) maxes = max(maxes, cnt[x] = (max(cnt[x] + 1, maxes))); else cnt[-x]--; } cout << maxes; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen(NAME ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(NAME ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...