답안 #1090045

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1090045 2024-09-17T16:07:51 Z onlk97 식물 비교 (IOI20_plants) C++14
14 / 100
4000 ms 8908 KB
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;

vector <int> p;
void init(int k,vector <int> r){
    int n=r.size();
    p.resize(n);
    for (int i=n; i; i--){
        vector <int> vec;
        for (int j=0; j<n; j++){
            if (!r[j]) vec.push_back(j);
        }
        int idx=vec[0];
        if (vec.size()>=2){
            int g=vec[0]-vec.back()+n;
            for (int j=1; j<vec.size(); j++){
                if (vec[j]-vec[j-1]>g){
                    g=vec[j]-vec[j-1];
                    idx=vec[j];
                }
            }
        }
        p[idx]=i;
        r[idx]=1e9;
        for (int j=0; j<k; j++){
            r[idx]--;
            idx--;
            if (idx<0) idx+=n;
        }
    }
}

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

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:17:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             for (int j=1; j<vec.size(); j++){
      |                           ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 432 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 3 ms 348 KB Output is correct
7 Correct 78 ms 5096 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 74 ms 5004 KB Output is correct
11 Correct 83 ms 5104 KB Output is correct
12 Correct 76 ms 5200 KB Output is correct
13 Correct 80 ms 5204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 3 ms 348 KB Output is correct
7 Correct 78 ms 5096 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 74 ms 5004 KB Output is correct
11 Correct 83 ms 5104 KB Output is correct
12 Correct 76 ms 5200 KB Output is correct
13 Correct 80 ms 5204 KB Output is correct
14 Correct 529 ms 5516 KB Output is correct
15 Execution timed out 4053 ms 8788 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 39 ms 4960 KB Output is correct
4 Execution timed out 4075 ms 8908 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 432 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 -