Submission #1837912
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[2][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[0][v].fst>y.fst) continue;
p[0][v] = PP(y.fst, P(y.snd.fst, i));
}
if(i==0) break;
memcpy(p[1], p[0], sizeof(p[0]));
rep(k, 2*m){
int u = a[k], v = b[k];
if(p[1][u].snd.snd!=i) continue;
if(p[1][u].fst<=p[0][v].fst) continue;
p[0][v] = PP(p[1][u].fst, P(p[1][u].snd.fst, p[1][u].snd.snd-1));
}
}
rep(i, n) printf("%d\n", p[0][i].snd.fst);
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Splatter Painting |
User |
Lepton |
Language |
C++14 (GCC 5.4.1) |
Score |
700 |
Code Size |
2020 Byte |
Status |
AC |
Exec Time |
70 ms |
Memory |
8000 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 |
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 |
3 ms |
4352 KB |
00_example_02.txt |
AC |
3 ms |
4352 KB |
10_01.txt |
AC |
4 ms |
4352 KB |
10_02.txt |
AC |
3 ms |
4352 KB |
10_03.txt |
AC |
3 ms |
4352 KB |
10_04.txt |
AC |
3 ms |
4352 KB |
10_05.txt |
AC |
3 ms |
4352 KB |
10_06.txt |
AC |
3 ms |
4352 KB |
10_07.txt |
AC |
3 ms |
4352 KB |
10_08.txt |
AC |
5 ms |
4352 KB |
10_09.txt |
AC |
5 ms |
4352 KB |
10_10.txt |
AC |
5 ms |
4352 KB |
10_11.txt |
AC |
5 ms |
4352 KB |
10_12.txt |
AC |
5 ms |
4352 KB |
10_13.txt |
AC |
4 ms |
4352 KB |
10_14.txt |
AC |
4 ms |
4352 KB |
10_15.txt |
AC |
4 ms |
4352 KB |
10_16.txt |
AC |
5 ms |
4352 KB |
10_17.txt |
AC |
5 ms |
4352 KB |
20_01.txt |
AC |
70 ms |
7824 KB |
20_02.txt |
AC |
70 ms |
7756 KB |
20_03.txt |
AC |
70 ms |
8000 KB |
20_04.txt |
AC |
13 ms |
4480 KB |
20_05.txt |
AC |
5 ms |
4480 KB |
20_06.txt |
AC |
12 ms |
5760 KB |
20_07.txt |
AC |
5 ms |
4480 KB |
20_08.txt |
AC |
19 ms |
5504 KB |
20_09.txt |
AC |
5 ms |
4480 KB |
20_10.txt |
AC |
19 ms |
5504 KB |
20_11.txt |
AC |
24 ms |
6144 KB |
20_12.txt |
AC |
35 ms |
5948 KB |
20_13.txt |
AC |
57 ms |
7168 KB |
20_14.txt |
AC |
60 ms |
7340 KB |
20_15.txt |
AC |
57 ms |
7744 KB |
20_16.txt |
AC |
60 ms |
7936 KB |