답안 #616003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
616003 2022-07-31T17:55:14 Z JeanBombeur 장난감 기차 (IOI17_train) C++17
23 / 100
146 ms 1392 KB
#include <iostream>
#include <cstdio>
#include <vector>
#include "train.h"
using namespace std;
 
const int MAX_NOEUDS = (5000);
 
vector <int> Remonte[MAX_NOEUDS];
 
bool DP[MAX_NOEUDS];
 
bool Arezou[MAX_NOEUDS];
bool Charge[MAX_NOEUDS];
 
bool Pris[MAX_NOEUDS];
 
vector <int> CurNodes;
 
int DegI[MAX_NOEUDS];
int Deg[MAX_NOEUDS];
 
int File[MAX_NOEUDS];
int deb = 0, fin = 0;
 
int nbNoeuds, nbAretes;
 
void Reset() {
    deb = 0, fin = 0;
    for (int i : CurNodes)
    {
        Pris[i] = false;
        Deg[i] = DegI[i];
    }
    return;
}
 
void Add(int noeud) {
    for (int dest : Remonte[noeud])
    {
        if (!Pris[dest] && (Arezou[dest] || -- Deg[dest] == 0))
        {
            File[fin ++] = dest;
            Pris[dest] = true;
        }
    }
    return;
}
 
bool Bfs() {
    for (int i : CurNodes)
    {
        if (DP[i] && Charge[i])
            Add(i);
    }
    while (deb < fin)
    {
        Add(File[deb ++]);
    }
    bool isOver = true;
    vector <int> nv;
    for (int i : CurNodes)
    {
        if (DP[i] && !Pris[i])
        {
            DP[i] = false;
            isOver = false;
            Pris[i] = true;
        }
        else
            nv.push_back(i);
    }
    CurNodes = nv;
    return isOver;
}
 
vector<int> who_wins(vector<int> Proprio, vector<int> Energie, vector<int> Left, vector<int> Right) {
    
    nbNoeuds = Proprio.size();
    nbAretes = Left.size();
    for (int i = 0; i < nbNoeuds; i ++)
    {
        Arezou[i] = Proprio[i];
        Charge[i] = Energie[i];
        DP[i] = true;
        CurNodes.push_back(i);
    }
    for (int i = 0; i < nbAretes; i ++)
    {
        Remonte[Right[i]].push_back(Left[i]);
        DegI[Left[i]] ++;
    }
    Reset();
    while (!Bfs())
        Reset();
        
    vector <int> Ans;
    for (int i = 0; i < nbNoeuds; i ++)
    {
        Ans.push_back(DP[i]);
    }
	return Ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 980 KB 3rd lines differ - on the 22nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 1392 KB Output is correct
2 Correct 91 ms 1388 KB Output is correct
3 Correct 117 ms 1380 KB Output is correct
4 Correct 8 ms 1364 KB Output is correct
5 Correct 11 ms 1380 KB Output is correct
6 Correct 8 ms 1336 KB Output is correct
7 Correct 7 ms 1372 KB Output is correct
8 Correct 6 ms 1364 KB Output is correct
9 Correct 6 ms 1208 KB Output is correct
10 Correct 7 ms 1316 KB Output is correct
11 Correct 6 ms 1316 KB Output is correct
12 Correct 5 ms 1212 KB Output is correct
13 Correct 6 ms 1372 KB Output is correct
14 Correct 7 ms 1364 KB Output is correct
15 Correct 7 ms 1364 KB Output is correct
16 Correct 7 ms 1364 KB Output is correct
17 Correct 7 ms 1340 KB Output is correct
18 Correct 146 ms 1064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1212 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1364 KB Output is correct
2 Correct 7 ms 1336 KB Output is correct
3 Correct 9 ms 1340 KB Output is correct
4 Correct 8 ms 1308 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 4 ms 856 KB Output is correct
7 Correct 7 ms 940 KB Output is correct
8 Correct 6 ms 980 KB Output is correct
9 Correct 7 ms 960 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
11 Correct 4 ms 948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 980 KB 3rd lines differ - on the 22nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -