답안 #422905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422905 2021-06-10T13:54:06 Z schse 장난감 기차 (IOI17_train) C++17
0 / 100
1816 ms 1332 KB
#include "train.h"
#ifndef EVAL
#include "grader.cpp"
#endif

#define DEACTIVATED -1
#define UNKNOWN 0
#include <bits/stdc++.h>
using namespace std;

struct node
{
	vector<int> edges;
	bool been;
	bool actice;
	int chargingsationsbefore = INT32_MAX;
	bool charging = false;
	bool owner;
	bool winningpos = false;
};

vector<node> g;

int dfs(int n, int charging)
{
	if (g[n].actice && g[n].chargingsationsbefore < charging)
		return true;
	else if (g[n].been)
		return false;
	g[n].been = true;
	g[n].actice = true;
	g[n].chargingsationsbefore = charging;

	if (g[n].charging)
		charging++;

	bool b = false;
	for (int i : g[n].edges)
	{
		b |= dfs(i, charging);
	}
	g[n].actice = false;
	g[n].chargingsationsbefore = INT32_MAX;
	return b;
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v)
{
	g.resize(a.size());
	for (int i = 0; i < a.size(); i++)
	{
		g[i].owner = a[i];
		g[i].charging = r[i];
	}
	for (int i = 0; i < u.size(); i++)
	{
		g[u[i]].edges.push_back(v[i]);
	}

	vector<int> res(a.size(), 0);
	for (int i = 0; i < (int)a.size(); i++)
	{
		for (int i = 0; i < a.size(); i++)
			g[i].been = false;
		res[i] = dfs(i, 0);
	}
	return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:50:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |  for (int i = 0; i < a.size(); i++)
      |                  ~~^~~~~~~~~~
train.cpp:55:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |  for (int i = 0; i < u.size(); i++)
      |                  ~~^~~~~~~~~~
train.cpp:63:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   for (int i = 0; i < a.size(); i++)
      |                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 299 ms 1104 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 220 ms 1332 KB Output is correct
2 Correct 225 ms 1316 KB Output is correct
3 Correct 227 ms 1228 KB Output is correct
4 Correct 1681 ms 1252 KB Output is correct
5 Correct 1246 ms 1196 KB Output is correct
6 Correct 831 ms 1124 KB Output is correct
7 Correct 666 ms 1100 KB Output is correct
8 Incorrect 396 ms 1220 KB 3rd lines differ - on the 27th token, expected: '1', found: '0'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1265 ms 1080 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1816 ms 1208 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 299 ms 1104 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -