답안 #652916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
652916 2022-10-25T06:59:39 Z coding_snorlax 식물 비교 (IOI20_plants) C++14
14 / 100
228 ms 11304 KB
#include<bits/stdc++.h>
#include "plants.h"
using namespace std;
int Answer[5005];
void init(int k,vector<int> r){
    int Total=(int)r.size();
    vector<int> zero;
    int Count=0;
    int Mark[5005]={0};
    int now;
    for(int j=0;j<(int)r.size();j++){
        zero.clear();
        for(int i=0;i<(int)r.size();i++){
            if ((!r[i]) && (!Mark[i])){
                zero.push_back(i);

            }
        }
        int first=zero[int(zero.size())-1]-Total;
        for(int i=0;i<(int)zero.size();i++){
            if(zero[i]-first>=k){
                now=zero[i];
                break;
            }
            else first=zero[i];
        }
        Answer[now]=Count;
        Mark[now]=1;
        for(int i=now+Total;i>now+Total-k;i--){
            r[i%Total]--;
        }
        Count++;
    }

}
int compare_plants(int x,int y){
    if(Answer[x]>Answer[y]) return -1;
    else return 1;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:29:17: warning: 'now' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |         for(int i=now+Total;i>now+Total-k;i--){
      |                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 8 ms 340 KB Output is correct
7 Correct 212 ms 5104 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 8 ms 340 KB Output is correct
10 Correct 212 ms 5000 KB Output is correct
11 Correct 169 ms 5012 KB Output is correct
12 Correct 172 ms 5128 KB Output is correct
13 Correct 228 ms 5108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 8 ms 340 KB Output is correct
7 Correct 212 ms 5104 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 8 ms 340 KB Output is correct
10 Correct 212 ms 5000 KB Output is correct
11 Correct 169 ms 5012 KB Output is correct
12 Correct 172 ms 5128 KB Output is correct
13 Correct 228 ms 5108 KB Output is correct
14 Runtime error 36 ms 7720 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 61 ms 4820 KB Output is correct
4 Runtime error 56 ms 11304 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Incorrect 1 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -