Submission #1041801

# Submission time Handle Problem Language Result Execution time Memory
1041801 2024-08-02T08:26:24 Z MarwenElarbi Comparing Plants (IOI20_plants) C++17
0 / 100
1 ms 2396 KB
    #include <bits/stdc++.h>
    #include "plants.h"
    using namespace std;
    const int nax=4e5+5;
    int mx[nax];
    int mn[nax];
    int n;
    void init(int k, std::vector<int> r) {
    	n=r.size();
    	for (int i = 0; i < n*2; ++i)
    	{
    		mx[i]=i;
    		mn[i]=i;
    	}
    	for (int i = 0; i < n*2; ++i)
    	{
    		if(r[i%n]>r[(i+1)%n]){
    			mn[i+1]=mn[i];
    		}else{
    			mx[i+1]=mx[i];
    		}
    	}
    	return;
    }
     
    int compare_plants(int x, int y) {
    	if(mx[y]<=x){
    		return -1;
    	}else if(mn[y]<=x){
    		return 1;
    	}else if(mx[x+n]<=y){
    		return 1;
    	}else if(mn[x+n]<=y){
    		return -1;
    	}else return 0;
    }
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -