Submission #1837881
Source Code Expand
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 200010
#define D 10
int a[N], b[N];
PP p[N];
int main(){
int n, m;
scanf("%d%d",&n,&m);
rep(i, m) scanf("%d%d",a+i,b+i);
rep(i, m){
a[i+m] = --b[i];
b[i+m] = --a[i];
}
int q;
scanf("%d", &q);
vector<PP> x[D+1];
rep(i, q){
int v, d, c;
scanf("%d%d%d",&v,&d,&c); v--;
x[d].push_back(PP(i+1, P(c, v)));
}
for(int i = D; i >= 0; i--){
for(auto &&y: x[i]){
int v = y.snd.snd;
if(p[v].fst>y.fst) continue;
p[v] = PP(y.fst, P(y.snd.fst, i));
}
rep(k, 2*m){
int u = a[k], v = b[k];
if(p[u].snd.snd==0) continue;
if(p[u].fst<p[v].fst) continue;
p[v] = PP(p[u].fst, P(p[u].snd.fst, p[u].snd.snd-1));
}
}
rep(i, n) printf("%d\n", p[i].snd.fst);
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Splatter Painting |
User |
Lepton |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1930 Byte |
Status |
WA |
Exec Time |
68 ms |
Memory |
5376 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:47:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&n,&m);
^
./Main.cpp:48:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(i, m) scanf("%d%d",a+i,b+i);
^
./Main.cpp:54:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &q);
^
./Main.cpp:58:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d",&v,&d,&c); v--;
^
Judge Result
Set Name |
Sample |
Subtask1 |
All |
Score / Max Score |
0 / 0 |
0 / 200 |
0 / 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 |
1 ms |
256 KB |
00_example_02.txt |
AC |
1 ms |
256 KB |
10_01.txt |
WA |
1 ms |
256 KB |
10_02.txt |
AC |
1 ms |
256 KB |
10_03.txt |
AC |
1 ms |
256 KB |
10_04.txt |
AC |
1 ms |
256 KB |
10_05.txt |
WA |
1 ms |
256 KB |
10_06.txt |
AC |
1 ms |
256 KB |
10_07.txt |
AC |
1 ms |
256 KB |
10_08.txt |
WA |
2 ms |
384 KB |
10_09.txt |
WA |
2 ms |
384 KB |
10_10.txt |
WA |
2 ms |
384 KB |
10_11.txt |
WA |
2 ms |
384 KB |
10_12.txt |
WA |
2 ms |
384 KB |
10_13.txt |
WA |
2 ms |
256 KB |
10_14.txt |
WA |
2 ms |
256 KB |
10_15.txt |
WA |
2 ms |
256 KB |
10_16.txt |
AC |
2 ms |
384 KB |
10_17.txt |
WA |
2 ms |
384 KB |
20_01.txt |
WA |
68 ms |
5136 KB |
20_02.txt |
WA |
68 ms |
5196 KB |
20_03.txt |
WA |
68 ms |
5312 KB |
20_04.txt |
WA |
12 ms |
1024 KB |
20_05.txt |
WA |
3 ms |
384 KB |
20_06.txt |
AC |
10 ms |
1664 KB |
20_07.txt |
WA |
3 ms |
384 KB |
20_08.txt |
AC |
17 ms |
1536 KB |
20_09.txt |
WA |
3 ms |
384 KB |
20_10.txt |
WA |
17 ms |
1408 KB |
20_11.txt |
WA |
22 ms |
2176 KB |
20_12.txt |
WA |
37 ms |
3200 KB |
20_13.txt |
WA |
57 ms |
4480 KB |
20_14.txt |
WA |
61 ms |
4652 KB |
20_15.txt |
AC |
63 ms |
5056 KB |
20_16.txt |
AC |
62 ms |
5376 KB |