Submission #1091911

# Submission time Handle Problem Language Result Execution time Memory
1091911 2024-09-22T14:25:24 Z idk__ Bouquet (EGOI24_bouquet) C++14
8 / 100
19 ms 2784 KB
#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

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 time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 13 ms 1884 KB Output is correct
3 Correct 15 ms 1884 KB Output is correct
4 Correct 13 ms 1884 KB Output is correct
5 Correct 16 ms 2016 KB Output is correct
6 Correct 17 ms 1880 KB Output is correct
7 Correct 18 ms 1884 KB Output is correct
8 Correct 19 ms 2016 KB Output is correct
9 Correct 19 ms 1884 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2020 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 15 ms 2648 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2020 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 2784 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 13 ms 1884 KB Output is correct
3 Correct 15 ms 1884 KB Output is correct
4 Correct 13 ms 1884 KB Output is correct
5 Correct 16 ms 2016 KB Output is correct
6 Correct 17 ms 1880 KB Output is correct
7 Correct 18 ms 1884 KB Output is correct
8 Correct 19 ms 2016 KB Output is correct
9 Correct 19 ms 1884 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 18 ms 2020 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Incorrect 15 ms 2648 KB Output isn't correct
20 Halted 0 ms 0 KB -