Submission #1121033

#TimeUsernameProblemLanguageResultExecution timeMemory
1121033FIFI_cppInfinite Race (EGOI24_infiniterace2)C++17
100 / 100
65 ms4960 KiB
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <deque> #include <fstream> #include <iterator> #include <set> #include <map> #include <unordered_map> #include <iomanip> #include <cctype> #include <string> #include <cassert> #include <set> #include <bitset> #include <unordered_set> #include <numeric> #define all(a) a.begin(), a.end() #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define pb push_back #define ppi pair<int,pair<int,int>> #define int int64_t using namespace std; // /\_/\ // (= ._.) // / > \> // encouraging cat const int INF = 10000000000000000; //const int mod = 1000000007; const int mod = 998244353; const int MAXN = 200005; //ifstream fin('xor.in'); //ofstream fout('xor.out'); signed main() { int n,q; cin >> n >> q; int laped = 0; vector<pair<bool, int>> infront(n, {true, 0}); // i infront of A int res = 0; while (q--) { int x; cin >> x; if (x > 0) { if (!infront[x].first && infront[x].second == laped) { laped++; res++; infront[x].second = laped; } else { infront[x].first = false; infront[x].second = laped; } } else { infront[-x].first = true; } } cout << res << '\n'; return 0; }

Compilation message (stderr)

Main.cpp:32:1: warning: multi-line comment [-Wcomment]
   32 | //    /\_/\
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...