답안 #1036013

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1036013 2024-07-27T01:49:06 Z mindiyak 장난감 기차 (IOI17_train) C++14
0 / 100
6 ms 1752 KB
#include "train.h"
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;

vvi paths(1e4,vi());
int N;
vi a,r;

int looses = 0;
int looped = 0;

void dfs(int pos,vi visited){
	if(looses)return;
	if(visited[pos]){
		looped = 1;
		if(!r[pos]){
			if(paths[pos].size() > 1 && a[pos] == 0){
				looses = 1;
			}else if(paths[pos].size() == 1 && a[pos] == 1){
				looses = 1;
			}
		}
		return;
	}
	visited[pos] = 1;
	for(int node:paths[pos]){
		dfs(node,visited);
	}
	
}


vi who_wins(vi A, vi R, vi u, vi v) {
	a = A;
	r = R;
	N=a.size();
	for (int i = 0; i < u.size(); i++){
		paths[u[i]].pb(v[i]);
		paths[v[i]].pb(u[i]);
	}
	
	vi ans(N,0);

	FOR(i,0,N){
		looses = 0;
		vi  visited(N,0);	
		if(looped)
			ans[i] = !looses;
	}

	return ans;
}

Compilation message

train.cpp: In function 'vi who_wins(vi, vi, vi, vi)':
train.cpp:73:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |  for (int i = 0; i < u.size(); i++){
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1116 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 600 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1628 KB Output is correct
2 Correct 5 ms 1628 KB Output is correct
3 Correct 5 ms 1624 KB Output is correct
4 Incorrect 6 ms 1752 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1368 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1500 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1116 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -