Submission #1073842

# Submission time Handle Problem Language Result Execution time Memory
1073842 2024-08-24T23:31:56 Z tolbi Comparing Plants (IOI20_plants) C++17
5 / 100
98 ms 8796 KB

    #include "plants.h"
    #include <set>
    std::vector<int> r;
    std::set<int> st;
    void init(int k, std::vector<int> r) {
    	::r=r;
    	for (int i = 0; i < r.size(); i++){
    		if (r[i]!=r[(i+r.size()-1)%r.size()]){
    			st.insert(i);
    		}
    	}
    }
     
    int compare_plants(int x, int y) {
    	if (st.lower_bound(x+1)==st.end() || *st.lower_bound(x+1)>=y){
    		return r[x]?-1:1;
    	}
    	if (st.lower_bound(y+1)==st.end() && *st.begin()>=x){
    		return r[y]?1:-1;
    	}
    	return 0;
    }

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:9:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |      for (int i = 0; i < r.size(); i++){
      |                      ~~^~~~~~~~~~
# 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 36 ms 4176 KB Output is correct
7 Correct 43 ms 5532 KB Output is correct
8 Correct 98 ms 8796 KB Output is correct
9 Correct 66 ms 8012 KB Output is correct
10 Correct 54 ms 8016 KB Output is correct
11 Correct 57 ms 8020 KB Output is correct
12 Correct 47 ms 8028 KB Output is correct
13 Correct 44 ms 8016 KB Output is correct
14 Correct 44 ms 7864 KB Output is correct
# 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 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 344 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 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 344 KB Output is correct
3 Correct 0 ms 344 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 36 ms 4176 KB Output is correct
7 Correct 43 ms 5532 KB Output is correct
8 Correct 98 ms 8796 KB Output is correct
9 Correct 66 ms 8012 KB Output is correct
10 Correct 54 ms 8016 KB Output is correct
11 Correct 57 ms 8020 KB Output is correct
12 Correct 47 ms 8028 KB Output is correct
13 Correct 44 ms 8016 KB Output is correct
14 Correct 44 ms 7864 KB Output is correct
15 Correct 0 ms 344 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 -