답안 #864905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864905 2023-10-23T17:48:22 Z andrei_boaca 식물 비교 (IOI20_plants) C++17
0 / 100
3 ms 8536 KB
#include "plants.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
vector<int> muchii[200005];
int n,bigger[200005],smaller[200005],lastsmall[200005],lastbig[200005];
bool use[200005];
int dist(int a,int b)
{
    return (b-a+n)%n;
}
void init(int k, std::vector<int> r)
{
    n=r.size();
    for(int i=0;i<n;i++)
    {
        if(r[i]==0)
        {
            int j=(i-1+n)%n;
            while(r[j]==1)
            {
                lastsmall[j]=i;
                j=(j-1+n)%n;
            }
        }
        if(r[i]==1)
        {
            int j=(i-1+n)%n;
            while(r[j]==0)
            {
                lastbig[j]=i;
                j=(j-1+n)%n;
            }
        }
    }
}
int compare_plants(int x, int y)
{
    if(dist(x,y)+dist(y,lastsmall[x])==dist(x,lastsmall[x]))
        return -1;
    if(dist(x,y)+dist(y,lastbig[x])==dist(x,lastbig[x]))
        return 1;
    if(dist(y,x)+dist(x,lastsmall[y])==dist(y,lastsmall[y]))
        return 1;
    if(dist(y,x)+dist(x,lastbig[y])==dist(y,lastbig[y]))
        return -1;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8284 KB Output is correct
2 Correct 2 ms 8284 KB Output is correct
3 Incorrect 2 ms 8284 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8280 KB Output is correct
2 Correct 2 ms 8536 KB Output is correct
3 Incorrect 2 ms 8284 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8280 KB Output is correct
2 Correct 2 ms 8536 KB Output is correct
3 Incorrect 2 ms 8284 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 8280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 8284 KB Output is correct
2 Correct 2 ms 8280 KB Output is correct
3 Incorrect 2 ms 8284 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8284 KB Output is correct
2 Correct 2 ms 8280 KB Output is correct
3 Incorrect 2 ms 8028 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 8284 KB Output is correct
2 Correct 2 ms 8284 KB Output is correct
3 Incorrect 2 ms 8284 KB Output isn't correct
4 Halted 0 ms 0 KB -