답안 #1055527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055527 2024-08-12T21:07:44 Z Hugo1729 낙하산 고리들 (IOI12_rings) C++11
0 / 100
124 ms 17224 KB
#include <bits/stdc++.h>
using namespace std;

int N;

int ans;

int cnt[1000001] = {0};

vector<int> prospects;

bool flag=0;

void Init(int N_) {

  N = N_;

  ans=N;

}

void Link(int A, int B) {
    if(prospects.size()==0){
        if(ans==0)return;

        cnt[A]++;
        cnt[B]++;

        if(max(cnt[A],cnt[B])>2){
            ans=0;

            if(cnt[A]>2){
                prospects.push_back(A);
                ans++;
            }

            if(cnt[B]>2){
                prospects.push_back(B);
                ans++;
            }
        }
        
    }else if(prospects.size()==1&&!flag){
        if(ans==0)return;
        cnt[A]++;
        cnt[B]++;

        if(prospects[0]!=A)swap(A,B);

        if(prospects[0]==A){
            if(cnt[B]==3){
                prospects.push_back(B);
                ans=2;
                flag=1;
            }
        }else{
            if(max(cnt[A],cnt[B])>2){
                ans=0;
            }
        }
    }
    else{
        if(ans==0)return;

        cnt[A]++;
        cnt[B]++;

        vector<int> sus,not_sus;            

        for(int v : prospects){
            if(v==A||v==B)sus.push_back(v);
            else not_sus.push_back(v);
        }

        if(sus.size()==0){
            if(max(cnt[A],cnt[B])>2)ans=0;
            return;
        }else{
            swap(sus,prospects);
            ans=1;
        }
    }

}

int CountCritical() {

  return ans;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 64 ms 9316 KB Output is correct
2 Correct 109 ms 13908 KB Output is correct
3 Correct 104 ms 16472 KB Output is correct
4 Incorrect 124 ms 17224 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 1 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 1 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 -