Submission #1041372

# Submission time Handle Problem Language Result Execution time Memory
1041372 2024-08-02T00:21:20 Z vjudge1 Comparing Plants (IOI20_plants) C++17
5 / 100
177 ms 16620 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
set<int> zero,one;
int n;
void init(int k, std::vector<int> r) {
    n=r.size();
    for(int i=0;i<n;i++)
        if(r[i])
            one.insert(i);
        else zero.insert(i);
	return;
}
bool noone(int x,int y){
    if(x>y) return noone(x,n)&&noone(0,y);
    return one.lower_bound(x)==one.lower_bound(y);
}
bool nozero(int x,int y){
    if(x>y) return nozero(x,n)&&nozero(0,y);
    return zero.lower_bound(x)==zero.lower_bound(y);
}
int compare_plants(int x, int y) {
    if(noone(x,y)) return 1;
    if(nozero(x,y)) return -1;
    if(noone(y,x)) return -1;
    if(nozero(y,x)) return 1;
    return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:8:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    8 |     for(int i=0;i<n;i++)
      |     ^~~
plants.cpp:12:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   12 |  return;
      |  ^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 Correct 32 ms 4028 KB Output is correct
7 Correct 84 ms 6484 KB Output is correct
8 Correct 170 ms 16568 KB Output is correct
9 Correct 177 ms 16468 KB Output is correct
10 Correct 151 ms 16556 KB Output is correct
11 Correct 157 ms 16464 KB Output is correct
12 Correct 173 ms 16620 KB Output is correct
13 Correct 62 ms 16464 KB Output is correct
14 Correct 152 ms 16464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 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 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 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 0 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 Correct 32 ms 4028 KB Output is correct
7 Correct 84 ms 6484 KB Output is correct
8 Correct 170 ms 16568 KB Output is correct
9 Correct 177 ms 16468 KB Output is correct
10 Correct 151 ms 16556 KB Output is correct
11 Correct 157 ms 16464 KB Output is correct
12 Correct 173 ms 16620 KB Output is correct
13 Correct 62 ms 16464 KB Output is correct
14 Correct 152 ms 16464 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -