답안 #1015031

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015031 2024-07-06T03:26:53 Z u_suck_o 식물 비교 (IOI20_plants) C++17
5 / 100
68 ms 8272 KB
#include "bits/stdc++.h"
#include "plants.h"
#define MAXN 200005

using namespace std;
int pref[MAXN];
int n;

void init(int k, vector<int> r) {
    n = r.size();
    pref[0] = r[0];
    for (int i = 1; i < n; i++)
        pref[i] = pref[i-1] + r[i];
    return;
}

int compare_plants(int x, int y) {
    if (x == 0) {
        if (pref[y-1] == 0) return 1;
        if (pref[y-1] == y) return -1;
        if (pref[n-1] - pref[y-1] == n-y) return 1;
        if (pref[n-1] - pref[y-1] == 0) return -1;
    } else {
        if (pref[y-1] - pref[x-1] == 0) return 1;
        if (pref[y-1] - pref[x-1] == y-x) return -1;
        if (pref[n-1] - pref[y-1] == n-y && pref[x-1] == x) return 1;
        if (pref[n-1] - pref[y-1] == 0 && pref[x-1] == 0) return -1;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 32 ms 4204 KB Output is correct
7 Correct 40 ms 5460 KB Output is correct
8 Correct 50 ms 8020 KB Output is correct
9 Correct 68 ms 8016 KB Output is correct
10 Correct 51 ms 8020 KB Output is correct
11 Correct 49 ms 7800 KB Output is correct
12 Correct 57 ms 8272 KB Output is correct
13 Correct 47 ms 8028 KB Output is correct
14 Correct 47 ms 8020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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 1 ms 344 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 1 ms 600 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 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 Correct 0 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Output isn't correct
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 Correct 1 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 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 32 ms 4204 KB Output is correct
7 Correct 40 ms 5460 KB Output is correct
8 Correct 50 ms 8020 KB Output is correct
9 Correct 68 ms 8016 KB Output is correct
10 Correct 51 ms 8020 KB Output is correct
11 Correct 49 ms 7800 KB Output is correct
12 Correct 57 ms 8272 KB Output is correct
13 Correct 47 ms 8028 KB Output is correct
14 Correct 47 ms 8020 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -