답안 #775960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
775960 2023-07-07T07:46:52 Z peteza 장난감 기차 (IOI17_train) C++14
0 / 100
2000 ms 25912 KB
#include <bits/stdc++.h>
#include "train.h"
using namespace std;

vector<int> adj[5005], tran[5005];
bool reach[5005][5005], reachtran[5005][5005];
bool vis[5005];

int st;

void dfs(int x, vector<int> *vec, bool trans) {
	if(vis[x]) return;
	vis[x] = 1;
	for(int e:vec[x]) {
		if(trans) reachtran[st][e] = 1;
		else reach[st][e] = 1;
		dfs(e, vec, trans);
	}
}

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	std::vector<int> res(a.size());
	for(int i=0;i<u.size();i++)
		adj[u[i]].push_back(v[i]);
	if(a[0] == 1) { // arezou (sub 3), find cyc with charging station
		for(st=0;st<a.size();st++) {
			memset(vis, 0,sizeof vis); dfs(st, adj, 0);
			memset(vis, 0,sizeof vis); dfs(st, tran, 1);
		}
		for(int i=0;i<a.size();i++) {
			if(r[i]) {
				bool yas = 0;
				for(int k=0;k<a.size();k++) {
					if(i != k && reach[i][k] && reach[k][i]) {
						yas = 1;
						break;
					}
				}
				res[i] = yas;
			} else {
				for(int k=0;k<a.size();k++) {
					bool yas = 0;
					for(int k=0;k<a.size();k++) {
						if(i != k && reach[i][k] && reach[k][i] && r[k]) {
							yas = 1;
							break;
						}
					}
					res[i] = yas;
				}				
			}

		}
	} else { //        borzou (sub 4), find cyc with NO charging station
  
	}
	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:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for(int i=0;i<u.size();i++)
      |              ~^~~~~~~~~
train.cpp:26:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for(st=0;st<a.size();st++) {
      |            ~~^~~~~~~~~
train.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int i=0;i<a.size();i++) {
      |               ~^~~~~~~~~
train.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int k=0;k<a.size();k++) {
      |                 ~^~~~~~~~~
train.cpp:41:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int k=0;k<a.size();k++) {
      |                 ~^~~~~~~~~
train.cpp:43:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |      for(int k=0;k<a.size();k++) {
      |                  ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 852 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 596 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2036 ms 25912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 980 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1064 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 852 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -