Submission #1091911

#TimeUsernameProblemLanguageResultExecution timeMemory
1091911idk__Bouquet (EGOI24_bouquet)C++14
8 / 100
19 ms2784 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; } // 7 // 0 0 = 1 // 0 0 = 1 // 1 0 // 1 0 // 2 0 // 3 0 // 2 0 //last = 1, 2-1=1 else if(flag2){ int cnt = 0; int check[n]={}; int last = 0; for(int i = 0;i < n; i++){ auto [x, y] = a[i]; if(i-x-1 < 0)check[i]=1, cnt++; else{ if(last < i-x)check[i]=1, cnt++; } if(check[i])last = i; } cout << cnt << endl; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:47:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   47 |             auto [x, y] = 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...