Submission #1091910

#TimeUsernameProblemLanguageResultExecution timeMemory
1091910idk__Bouquet (EGOI24_bouquet)C++14
8 / 100
23 ms4188 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; pair<int, int>a[n]; bool flag = 1; bool flag2 = 1; int xx,yy; for(int i = 0;i < n; i++){ int x, y; cin >> x >> y; a[i] = {x, y}; if(!i)xx=y, yy=y; if(x!=y or xx!=x)flag = 0; if(y!=0)flag2 = 0; } if(flag){ int cnt = 0; for(int i = 0;i < n;){ i+=xx+1; cnt++; } cout << cnt << endl; } else if(flag2){ int cnt = 0; int check[n]={}; int last = 0; for(int i = 0;i < n; i++){ auto [y, x] = a[i]; if(i-x-1 < 0)check[i]=1, cnt++; else{ if(last < i-x-1)check[i]=1, cnt++; } if(check[i])last = i; } cout << cnt << endl; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:38:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   38 |             auto [y, x] = a[i];
      |                  ^
Main.cpp:15:12: warning: variable 'yy' set but not used [-Wunused-but-set-variable]
   15 |     int xx,yy;
      |            ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...