답안 #385930

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385930 2021-04-05T08:54:12 Z i_am_noob 식물 비교 (IOI20_plants) C++17
5 / 100
94 ms 8812 KB
#include<bits/stdc++.h>
#include "plants.h"
using namespace std;

#define ll long long
//#define int ll
#define rep(n) rep1(i,n)
#define rep1(i,n) rep2(i,0,n)
#define rep2(i,a,b) for(int i=a; i<(b); ++i)
#define rep3(i,a,b) for(int i=a; i>=(b); --i)
#define pb push_back
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define inf 0x3f3f3f3f3f3f3f3f
#define pow2(x) (1ll<<(x))

#ifdef i_am_noob
#define bug(...) cerr << "#" << __LINE__ << " " << #__VA_ARGS__ << "- ", _do(__VA_ARGS__)
template<typename T> void _do(T x){cerr << x << endl;}
template<typename T, typename ...S> void _do(T x, S... y){cerr << x << ", ";_do(y...);}
#else
#define bug(...) 49
#endif

const int maxn=200005;

int n,k,sum[maxn];
vector<int> r;

void init(int _k, vector<int> _r){
    k=_k;
    r=_r;
    n=sz(r);
    rep(n) sum[i+1]=sum[i]+r[i];
}

int compare_plants(int x, int y) {
    if(k==2){
        if(sum[y]-sum[x]==y-x) return -1;
        if(sum[y]-sum[x]==0) return 1;
        if(sum[n]-sum[y]+sum[x]==n-y+x) return 1;
        if(sum[n]-sum[y]+sum[x]==0) return -1;
        return 0;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 60 ms 4204 KB Output is correct
7 Correct 71 ms 5740 KB Output is correct
8 Correct 92 ms 8684 KB Output is correct
9 Correct 90 ms 8684 KB Output is correct
10 Correct 93 ms 8684 KB Output is correct
11 Correct 92 ms 8736 KB Output is correct
12 Correct 94 ms 8812 KB Output is correct
13 Correct 87 ms 8684 KB Output is correct
14 Correct 88 ms 8684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 60 ms 4204 KB Output is correct
7 Correct 71 ms 5740 KB Output is correct
8 Correct 92 ms 8684 KB Output is correct
9 Correct 90 ms 8684 KB Output is correct
10 Correct 93 ms 8684 KB Output is correct
11 Correct 92 ms 8736 KB Output is correct
12 Correct 94 ms 8812 KB Output is correct
13 Correct 87 ms 8684 KB Output is correct
14 Correct 88 ms 8684 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Incorrect 1 ms 364 KB Output isn't correct
18 Halted 0 ms 0 KB -