답안 #397250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
397250 2021-05-01T18:41:07 Z Antekb 식물 비교 (IOI20_plants) C++14
14 / 100
4000 ms 8808 KB
#include "plants.h"
#include<bits/stdc++.h>
#define pb(x) push_back(x)
using namespace std;
vector<int> V, V3;
void init(int k, std::vector<int> r) {
    int n=r.size();
    k--;
    V.resize(n);
    V3.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]++;
		}
	}
    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=V2.size()-1;l>=0; l--)if(((V2[(l+1)%(V2.size())]-V2[l]+n)%n)>k)j=V2[(l+1)%V2.size()];
        }
        V3[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] && V3[x]<V3[y])return -1;
	if(V[x]>V[y] && V3[x]>V3[y])return 1;
   	return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:21:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |       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()];
      |                    ~^~~~~~~~~~
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 17 ms 368 KB Output is correct
7 Correct 424 ms 3124 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 17 ms 332 KB Output is correct
10 Correct 424 ms 3140 KB Output is correct
11 Correct 357 ms 3012 KB Output is correct
12 Correct 567 ms 3272 KB Output is correct
13 Correct 487 ms 3172 KB Output is correct
# 결과 실행 시간 메모리 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 17 ms 368 KB Output is correct
7 Correct 424 ms 3124 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 17 ms 332 KB Output is correct
10 Correct 424 ms 3140 KB Output is correct
11 Correct 357 ms 3012 KB Output is correct
12 Correct 567 ms 3272 KB Output is correct
13 Correct 487 ms 3172 KB Output is correct
14 Execution timed out 4073 ms 2972 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 101 ms 3068 KB Output is correct
4 Execution timed out 4067 ms 7652 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 9 ms 332 KB Output is correct
6 Execution timed out 4067 ms 8808 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -