Submission #1264168

#TimeUsernameProblemLanguageResultExecution timeMemory
1264168codergInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
65 ms9796 KiB
/* 26.08.25 */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<bool> vb; typedef vector<pair<ll,ll>> vpll; typedef vector<pair<int,int>> vpii; #define el "\n" #define yes cout<<"YES\n" #define no cout<<"NO\n" #define srt(x) sort(x.begin(),x.end()) #define rev(x) reverse(x.begin(),x.end()) #define tests \ ll t; \ cin >> t; \ while (t--) #define sz(x) (ll)x.size() #define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 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);}} #define db double #define F first #define S second const ll INF = 1e18; const ll MAXN= 1e6; const ll MOD=1e9+7; #define pi 3.14159265358979323846 signed main() { fastIO; 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<<el; return 0; }

Compilation message (stderr)

Main.cpp: In function 'void setIO(std::string)':
Main.cpp:23:113: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 | 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:23:157: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 | 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...