답안 #1055517

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

int N;

int ans;

int cnt[1000001] = {0};

vector<int> prospects;

void Init(int N_) {

  N = N_;

  ans=N;

}

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

        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(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 0 ms 348 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 71 ms 9456 KB Output is correct
2 Correct 106 ms 14164 KB Output is correct
3 Correct 103 ms 16976 KB Output is correct
4 Incorrect 122 ms 17744 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 0 ms 348 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 0 ms 348 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 -