Submission #1242475
Source Code Expand
#include<bits/stdc++.h> using namespace std; using ll=long long; const ll mn=1e5+7; ll ai[mn],bi[mn],ci[mn]; ll dp[mn][11]; int main(){ ll n,m;cin>>n>>m; for(ll a=0;a<m;++a){cin>>ai[a]>>bi[a];--ai[a];--bi[a];} memset(dp,-1,sizeof(dp)); ll q;cin>>q; for(ll a=0;a<q;++a){ ll v,d;cin>>v>>d>>ci[a]; --v; dp[v][d]=a; } for(ll a=10;a>=1;--a){ for(ll b=0;b<n;++b)dp[b][a-1]=max(dp[b][a-1],dp[b][a]); for(ll b=0;b<m;++b){ dp[ai[b]][a-1]=max(dp[ai[b]][a-1],dp[bi[b]][a]); dp[bi[b]][a-1]=max(dp[bi[b]][a-1],dp[ai[b]][a]); } } for(ll a=0;a<n;++a)cout<<(dp[a][0]>-1?ci[dp[a][0]]:0)<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Splatter Painting |
User | Veronica |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 645 Byte |
Status | AC |
Exec Time | 287 ms |
Memory | 11520 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 500 / 500 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
Subtask1 | 00_example_01.txt, 00_example_02.txt, 10_01.txt, 10_02.txt, 10_03.txt, 10_04.txt, 10_05.txt, 10_06.txt, 10_07.txt, 10_08.txt, 10_09.txt, 10_10.txt, 10_11.txt, 10_12.txt, 10_13.txt, 10_14.txt, 10_15.txt, 10_16.txt, 10_17.txt |
All | 00_example_01.txt, 00_example_02.txt, 10_01.txt, 10_02.txt, 10_03.txt, 10_04.txt, 10_05.txt, 10_06.txt, 10_07.txt, 10_08.txt, 10_09.txt, 10_10.txt, 10_11.txt, 10_12.txt, 10_13.txt, 10_14.txt, 10_15.txt, 10_16.txt, 10_17.txt, 20_01.txt, 20_02.txt, 20_03.txt, 20_04.txt, 20_05.txt, 20_06.txt, 20_07.txt, 20_08.txt, 20_09.txt, 20_10.txt, 20_11.txt, 20_12.txt, 20_13.txt, 20_14.txt, 20_15.txt, 20_16.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 4 ms | 10496 KB |
00_example_02.txt | AC | 4 ms | 10496 KB |
10_01.txt | AC | 5 ms | 10496 KB |
10_02.txt | AC | 4 ms | 10496 KB |
10_03.txt | AC | 4 ms | 10496 KB |
10_04.txt | AC | 4 ms | 10496 KB |
10_05.txt | AC | 5 ms | 10496 KB |
10_06.txt | AC | 4 ms | 10496 KB |
10_07.txt | AC | 6 ms | 10496 KB |
10_08.txt | AC | 9 ms | 10496 KB |
10_09.txt | AC | 9 ms | 10496 KB |
10_10.txt | AC | 9 ms | 10496 KB |
10_11.txt | AC | 9 ms | 10496 KB |
10_12.txt | AC | 9 ms | 10496 KB |
10_13.txt | AC | 8 ms | 10496 KB |
10_14.txt | AC | 8 ms | 10496 KB |
10_15.txt | AC | 8 ms | 10496 KB |
10_16.txt | AC | 9 ms | 10496 KB |
10_17.txt | AC | 9 ms | 10496 KB |
20_01.txt | AC | 287 ms | 11520 KB |
20_02.txt | AC | 286 ms | 11520 KB |
20_03.txt | AC | 284 ms | 11520 KB |
20_04.txt | AC | 36 ms | 10752 KB |
20_05.txt | AC | 8 ms | 10496 KB |
20_06.txt | AC | 149 ms | 10624 KB |
20_07.txt | AC | 9 ms | 10496 KB |
20_08.txt | AC | 48 ms | 10496 KB |
20_09.txt | AC | 9 ms | 10496 KB |
20_10.txt | AC | 49 ms | 10496 KB |
20_11.txt | AC | 64 ms | 10496 KB |
20_12.txt | AC | 206 ms | 11392 KB |
20_13.txt | AC | 257 ms | 11520 KB |
20_14.txt | AC | 263 ms | 11520 KB |
20_15.txt | AC | 278 ms | 11392 KB |
20_16.txt | AC | 284 ms | 11520 KB |