QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#857899 | #9677. 基础博弈练习题 | fzx | 0 | 67ms | 34900kb | C++20 | 951b | 2025-01-16 09:40:08 | 2025-01-16 09:40:08 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
const int INF=1e6+5;
int n,m,k,a[INF],f[INF],in[INF],b[INF];
queue <int> q;
vector <int> e[INF],e2[INF];
void solve() {
cin>>n>>m>>k;
for (int i=1;i<=n;i++) cin>>a[i];
for (int i=1;i<=k;i++) cin>>b[i];
for (int i=1;i<=m;i++) {
int x=0,y=0;cin>>x>>y;
e[x].pb(y);e2[y].pb(x);in[x]++;
}
memset(f,63,sizeof f);
for (int i=1;i<=n;i++)
if (!in[i]) q.push(i);
while (q.size()) {
int x=q.front();q.pop();
for (int v:e2[x]) {
f[v]=min(f[v],f[x]);
if (a[x]<=k && f[v]-1>a[x]) f[v]=a[x];
if (!--in[v]) q.push(v);
}
}
for (int i=1;i<=n;i++)
if (f[i]>k*2) cout<<"-1 ";
else cout<<f[i]-1<<" ";
}
signed main()
{
ios::sync_with_stdio(false);
int t=1;
while (t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 18008kb
input:
83 93 13 8 9 10 7 7 7 6 3 1 10 6 2 5 7 1 3 4 2 1 10 7 4 8 9 2 2 1 9 2 5 1 7 8 6 1 9 9 10 4 1 2 9 2 3 4 2 9 10 8 1 4 1 8 4 1 4 4 7 4 8 2 9 2 5 2 2 3 3 8 5 2 9 3 10 8 8 1 6 6 1 6 7 10 7 5 10 3 2 2 7 4 8 7 6 6 5 56 36 33 41 32 62 37 7 6 53 41 13 9 36 44 77 38 62 76 16 72 5 40 13 55 60 5 78 72 45 13 44 ...
output:
5 -1 -1 -1 1 0 -1 3 8 -1 0 -1 0 -1 2 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 1 -1 2 -1 -1 0 -1 1 -1 0 -1 -1 0 0 -1 -1 1 7 0 0 7 8 -1 -1 0 -1 -1 6 -1 -1 -1 7 -1 0 0 -1 -1 1 1 1 -1 2 -1 2 0 -1 -1 -1 0
result:
wrong answer 1st numbers differ - expected: '0', found: '5'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 67ms
memory: 34900kb
input:
100000 355071 10000 5 7 4 7 4 1 10 5 9 4 9 4 3 10 5 4 9 1 7 10 1 6 10 3 10 9 8 4 6 3 10 8 6 8 3 5 10 9 7 7 1 3 8 8 6 2 8 4 2 9 1 10 3 6 3 8 9 10 5 7 3 2 1 5 7 4 3 4 6 4 2 7 2 5 5 6 4 6 7 4 4 6 4 2 3 9 9 9 10 8 1 6 7 2 9 8 2 3 1 6 9 4 10 3 10 1 2 3 3 4 1 1 1 5 8 6 8 3 1 6 2 9 5 9 4 7 2 10 7 5 2 2 7 4...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 915th numbers differ - expected: '0', found: '1'
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%