답안 #623049

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
623049 2022-08-05T06:35:30 Z Siffer 식물 비교 (IOI20_plants) C++14
5 / 100
93 ms 10316 KB
#include "plants.h"
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second

vector<pair<int,int>> v, d;
int n;

void init(int p, vector<int> r) {
    n = r.size();
    int s = 0; for(;r[s]; s++); s++;
    v.resize(n);
    d.resize(n);
    int b = s;
    int k = 0;
    for(int i = 0; i < n; i++) {
        v[(s+i)%n] = {b, k++};
        if(r[(s+i)%n] == 0) b = s+i+1, k = 0;
    }
    s = 0; for(;r[s]-1; s++); s++;
    b = s;
    k = 0;
    for(int i = 0; i < n; i++) {
        d[(s+i)%n] = {b, k++};
        if(r[(s+i)%n]) b = s+i+1, k = 0;
    }
}

int compare_plants(int x, int y) {
    if(v[x].F != v[y].F) {
        if(d[x].F != d[y].F) return 0;
        if(d[x].S > d[y].S) return -1;
        return 1;
    }
    if(v[x].S > v[y].S) return 1;
    return -1;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 49 ms 4040 KB Output is correct
7 Correct 54 ms 5708 KB Output is correct
8 Correct 79 ms 10204 KB Output is correct
9 Correct 74 ms 10260 KB Output is correct
10 Correct 76 ms 10180 KB Output is correct
11 Correct 71 ms 10208 KB Output is correct
12 Correct 72 ms 10172 KB Output is correct
13 Correct 68 ms 10172 KB Output is correct
14 Correct 93 ms 10316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 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 1 ms 212 KB Output is correct
2 Correct 0 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 Incorrect 0 ms 212 KB Output isn't correct
3 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 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 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 300 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 49 ms 4040 KB Output is correct
7 Correct 54 ms 5708 KB Output is correct
8 Correct 79 ms 10204 KB Output is correct
9 Correct 74 ms 10260 KB Output is correct
10 Correct 76 ms 10180 KB Output is correct
11 Correct 71 ms 10208 KB Output is correct
12 Correct 72 ms 10172 KB Output is correct
13 Correct 68 ms 10172 KB Output is correct
14 Correct 93 ms 10316 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Incorrect 0 ms 212 KB Output isn't correct
18 Halted 0 ms 0 KB -