Submission #397247

# Submission time Handle Problem Language Result Execution time Memory
397247 2021-05-01T18:34:45 Z Antekb Comparing Plants (IOI20_plants) C++14
14 / 100
4000 ms 9864 KB
#include "plants.h"
#include<bits/stdc++.h>
#define pb(x) push_back(x)
using namespace std;
vector<int> V, V2;
void init(int k, std::vector<int> r) {
    int n=r.size();
    k--;
    V.resize(n);
    auto r2=r;
    for(int i=0; i<n; i++){
    	vector<int> V2;
    	for(int j=0; j<n; j++){
    		if(r2[j]==k){
    			V2.push_back(j);
    		}
    	}
    	int j=V2[0];
    	if(V2.size()>1){
    		for(int l=0; l<V2.size(); l++)if(((V2[(l+1)%(V2.size())]-V2[l]+n)%n)>k)j=V2[(l+1)%V2.size()];
    	}
    	V[j]=i;
    	r2[j]=-1;
    	for(int l=1; l<=k; l++){
			r2[(j-l+n)%n]++;
		}
	}
	return;
}     
int compare_plants(int x, int y){
	if(V[x]<V[y])return -1;
	if(V[x]>V[y])return 1;
   	return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:20:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |       for(int l=0; l<V2.size(); l++)if(((V2[(l+1)%(V2.size())]-V2[l]+n)%n)>k)j=V2[(l+1)%V2.size()];
      |                    ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 8 ms 352 KB Output is correct
7 Correct 202 ms 5096 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 8 ms 308 KB Output is correct
10 Correct 198 ms 5088 KB Output is correct
11 Correct 155 ms 4996 KB Output is correct
12 Correct 265 ms 5188 KB Output is correct
13 Correct 221 ms 5060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 8 ms 352 KB Output is correct
7 Correct 202 ms 5096 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 8 ms 308 KB Output is correct
10 Correct 198 ms 5088 KB Output is correct
11 Correct 155 ms 4996 KB Output is correct
12 Correct 265 ms 5188 KB Output is correct
13 Correct 221 ms 5060 KB Output is correct
14 Correct 1588 ms 5572 KB Output is correct
15 Execution timed out 4070 ms 9404 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 75 ms 4804 KB Output is correct
4 Execution timed out 4051 ms 9864 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -