답안 #139489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139489 2019-07-31T21:24:42 Z arthurconmy 장난감 기차 (IOI17_train) C++14
5 / 100
9 ms 760 KB
#include <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
	#include "train.h"
#endif

using namespace std;

const int MAXN = 5000;

bool is_loop[MAXN];
bool go_next[MAXN];

vector<int> who_wins(vector<int> A, vector<int> R, vector<int> U, vector<int> V)
{
	int n = A.size();
	int m = V.size();

	for(int i=0; i<m; i++)
	{
		if(U[i]==V[i]) is_loop[U[i]]=1;
		else go_next[min(U[i],V[i])]=1;
	}

	vector<int> ans;

	for(int i=0; i<n; i++)
	{
		int cur=i;

		while(true)
		{
			if(is_loop[cur] && A[cur] && R[cur]) ans.push_back(1);
			if(is_loop[cur] && !A[cur] && !R[cur]) ans.push_back(0);

			if(ans.size()==i+1) break;

			if(!go_next[cur]) ans.push_back(R[cur]);

			if(ans.size()==i+1) break;

			cur=cur+1;
		}
	}

	return ans;
}

#ifdef ARTHUR_LOCAL
	int main()
	{
		cout << "ppop" << endl;
	}
#endif

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:35:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(ans.size()==i+1) break;
       ~~~~~~~~~~^~~~~
train.cpp:39:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(ans.size()==i+1) break;
       ~~~~~~~~~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 6 ms 632 KB Output is correct
5 Correct 6 ms 680 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 6 ms 632 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 5 ms 656 KB Output is correct
10 Correct 5 ms 664 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 760 KB 3rd lines differ - on the 1360th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 632 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 760 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
4 Correct 6 ms 632 KB Output is correct
5 Correct 6 ms 680 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 6 ms 632 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 5 ms 656 KB Output is correct
10 Correct 5 ms 664 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
12 Incorrect 2 ms 256 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -