Submission #1276699

#TimeUsernameProblemLanguageResultExecution timeMemory
1276699coderg300711Infinite Race (EGOI24_infiniterace2)C++20
100 / 100
66 ms9616 KiB
#include <bits/stdc++.h> #include <vector> using namespace std; typedef long long ll; void setIO(string name = ""){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}} const ll maxn=2e5+5,mod=1e9+7; signed main(){ setIO(""); ll n,ans=0,q; cin>>n>>q; set<ll> s; for(ll i=0;i<q;i++){ ll x; cin>>x; if(x>0){ if(s.count(x)){ ans++; s.clear(); } s.insert(x); }else s.erase(-x); } cout<<ans<<'\n'; return 0; }

Compilation message (stderr)

Main.cpp: In function 'void setIO(std::string)':
Main.cpp:5:113: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void setIO(string name = ""){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}}
      |                                                                                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:5:157: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void setIO(string name = ""){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "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...