답안 #805967

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
805967 2023-08-04T03:54:47 Z fatemetmhr 장난감 기차 (IOI17_train) C++17
23 / 100
98 ms 1720 KB
//  ~ Be Name Khoda ~  //
 
#include "train.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")
 
using namespace std;
 
typedef long long ll;
 
#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second
 
const int maxn  =  1e6   + 10;
const int maxn5 =  5e3   + 10;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;
 
int cnt[maxn5], q[maxn5];
vector <int> adj[maxn5], jda[maxn5], ret;
bool good[maxn5];
int n, m;

 
std::vector<int> who_wins(std::vector<int> a, std::vector<int> ch, std::vector<int> u, std::vector<int> v) {
	n = a.size(); 
	m = u.size();
 	for(int i = 0; i < m; i++){
 		adj[u[i]].pb(v[i]);
 		jda[v[i]].pb(u[i]);
 	}
 	bool con = true;
 	while(con){
 		con = false;
 		memset(good, false, sizeof good);
 		int l = 0, r = 0;
 		for(int i = 0; i < n; i++){
 			cnt[i] = adj[i].size();
 			if(ch[i])
 				q[r++] = i;
 		}
 		while(l < r){
 			int v = q[l++];
 			for(auto u : jda[v]) if(!good[u]){
 				if(a[u] || cnt[u] == 1){
 					good[u] = true;
 					q[r++] = u;
 				}
 				else
 					cnt[u]--;
 			}
 		}
 		for(int i = 0; i < n; i++) if(ch[i] && !good[i]){
 			ch[i] = false;
 			con = true;
 		}
 	}
 	for(int i = 0; i < n; i++)
 		ret.pb(good[i]);
 	return ret;
}
 
 
 
 
 
 
 
 
 
 
 
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1108 KB 3rd lines differ - on the 26th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 544 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 1620 KB Output is correct
2 Correct 54 ms 1620 KB Output is correct
3 Correct 63 ms 1620 KB Output is correct
4 Correct 6 ms 1592 KB Output is correct
5 Correct 9 ms 1720 KB Output is correct
6 Correct 6 ms 1584 KB Output is correct
7 Correct 6 ms 1588 KB Output is correct
8 Correct 5 ms 1580 KB Output is correct
9 Correct 5 ms 1560 KB Output is correct
10 Correct 5 ms 1604 KB Output is correct
11 Correct 5 ms 1492 KB Output is correct
12 Correct 5 ms 1472 KB Output is correct
13 Correct 6 ms 1620 KB Output is correct
14 Correct 6 ms 1620 KB Output is correct
15 Correct 6 ms 1584 KB Output is correct
16 Correct 6 ms 1620 KB Output is correct
17 Correct 6 ms 1620 KB Output is correct
18 Correct 98 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1364 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1588 KB Output is correct
2 Correct 6 ms 1580 KB Output is correct
3 Correct 6 ms 1560 KB Output is correct
4 Correct 5 ms 1476 KB Output is correct
5 Correct 1 ms 596 KB Output is correct
6 Correct 3 ms 1072 KB Output is correct
7 Correct 4 ms 1204 KB Output is correct
8 Correct 4 ms 1200 KB Output is correct
9 Correct 4 ms 1288 KB Output is correct
10 Correct 1 ms 724 KB Output is correct
11 Correct 3 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1108 KB 3rd lines differ - on the 26th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -