답안 #306514

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306514 2020-09-25T18:30:32 Z giorgikob 식물 비교 (IOI20_plants) C++14
5 / 100
106 ms 5880 KB
#include "plants.h"

#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

const int N = 5e5;

vector<int>v;
int n;
int R[N], L[N];

void init(int k, std::vector<int> r) {
    n = r.size();
    int a = 0;
    for(int i = 0; i < n; i++){
        if(a < i) a = i;
        while(r[a%n] == 0) a++;
        R[i] = a;
    }

    int b = n-1;
    for(int i = n-1; i >= 0; i--){
        if(b > i) b = i;
        while(r[(b-1+n) % n] == 1) b--;
        L[i] = b;
    }

    for(int i = 0; i < n; i++){
        if(L[i] < 0) L[i] += n, R[i] += n;
    }

	return;
}

bool check(int x,int y){
    return (L[x] <= y && y <= R[x]) ||
           (L[x] <= y+n && y+n <= R[x]);
}
int compare_plants(int x, int y) {
    if(check(x,y)) return 1;
    if(check(y,x)) return -1;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 60 ms 3192 KB Output is correct
7 Correct 78 ms 3448 KB Output is correct
8 Correct 104 ms 5784 KB Output is correct
9 Correct 106 ms 5752 KB Output is correct
10 Correct 106 ms 5880 KB Output is correct
11 Correct 104 ms 5752 KB Output is correct
12 Correct 103 ms 5756 KB Output is correct
13 Correct 104 ms 5880 KB Output is correct
14 Correct 103 ms 5756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Incorrect 0 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 0 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 60 ms 3192 KB Output is correct
7 Correct 78 ms 3448 KB Output is correct
8 Correct 104 ms 5784 KB Output is correct
9 Correct 106 ms 5752 KB Output is correct
10 Correct 106 ms 5880 KB Output is correct
11 Correct 104 ms 5752 KB Output is correct
12 Correct 103 ms 5756 KB Output is correct
13 Correct 104 ms 5880 KB Output is correct
14 Correct 103 ms 5756 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Incorrect 1 ms 256 KB Output isn't correct
18 Halted 0 ms 0 KB -