답안 #341510

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
341510 2020-12-29T21:45:48 Z MvC 식물 비교 (IOI20_plants) C++14
5 / 100
94 ms 9708 KB
#include "plants.h"
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=2e5+50;
const ll mod=1e9+7;
using namespace std;
int n,i,a[nmax],p[nmax],s[nmax];
void init(int k,vector<int> r)
{
    n=lun(r);
    for(i=0;i<n;i++)a[i]=r[i];
    p[0]=a[0],s[n-1]=a[n-1];
    for(i=1;i<n;i++)p[i]=p[i-1]+a[i];
    for(i=n-2;i>=0;i--)s[i]=s[i+1]+a[i];
}
int compare_plants(int x,int y)
{
    int z=0;
    if(x>0)z=p[x-1];
    if(p[y-1]-z==0)return 1;
    if(p[y-1]-z==y-x)return -1;
    if(s[y]+z==0)return -1;
    if(s[y]+z==n-y+x)return 1;
    return 0;
}
/*int main()
{
    //freopen("sol.in","r",stdin);
    //freopen("sol.out","w",stdout);
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);

    return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 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 59 ms 4204 KB Output is correct
7 Correct 71 ms 5740 KB Output is correct
8 Correct 91 ms 9452 KB Output is correct
9 Correct 93 ms 9708 KB Output is correct
10 Correct 92 ms 9452 KB Output is correct
11 Correct 94 ms 9452 KB Output is correct
12 Correct 88 ms 9452 KB Output is correct
13 Correct 89 ms 9580 KB Output is correct
14 Correct 85 ms 9452 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 0 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 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 0 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 0 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 59 ms 4204 KB Output is correct
7 Correct 71 ms 5740 KB Output is correct
8 Correct 91 ms 9452 KB Output is correct
9 Correct 93 ms 9708 KB Output is correct
10 Correct 92 ms 9452 KB Output is correct
11 Correct 94 ms 9452 KB Output is correct
12 Correct 88 ms 9452 KB Output is correct
13 Correct 89 ms 9580 KB Output is correct
14 Correct 85 ms 9452 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 -