Submission #1195002


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
int inf_int=1e9;
ll inf_ll=1e16;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
const double pi=3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define siz(a) a.size()
#define EPS 1e-7
#define next asdfafgasgasg
bool debug=0;
typedef long double dbl;
const int MAXN = 2e5;
const int MOD = 1e9 +7;



vector<int> g[MAXN];
pii val[MAXN][11];
void solve()
{
    int n;
    cin >> n;
    int m;
    cin >> m;
    for(int i=1;i<=m;++i){
        int a,b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
    }

    int q;
    cin >> q;
    for(int j=1;j<=q;++j){
        int d,v,c;
        cin >> v >> d >> c ;
        val[v][d]={j,c};
    }

    for(int d=10;d>=1;d--){
        for(int v=1;v<=n;v++){
            for(int to:g[v]){
                val[to][d-1]=max(val[to][d-1],val[v][d]);
            }
            val[v][d-1]=max(val[v][d-1],val[v][d]);
        }

    }

    for(int i=1;i<=n;++i){
        if(i>1){
            cout <<"\n";
        }
        cout << val[i][0].se;

    }
    cout <<"\n";

}


#define FILE "palindrome"
int main()
{
        #ifdef zxc
            freopen("input.txt","r",stdin);
 //          freopen("output.txt","w",stdout);
        #else
         //     freopen(FILE".in","r",stdin);
         //     freopen(FILE".out","w",stdout);
        #endif // zxc

     //  freopen(FILE".in","r",stdin);
     //   freopen(FILE".out","w",stdout);

     //   freopen("input.txt","r",stdin);
       // freopen("output.txt","w",stdout);

       if(!debug)
       {
            ios_base::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
       }

        int t=1;
        while(t--)
           solve();
        return 0;
}

Submission Info

Submission Time
Task B - Splatter Painting
User the_art_of_war
Language C++14 (GCC 5.4.1)
Score 700
Code Size 1956 Byte
Status AC
Exec Time 117 ms
Memory 19960 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 500 / 500
Status
AC × 2
AC × 19
AC × 35
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 5760 KB
00_example_02.txt AC 3 ms 5760 KB
10_01.txt AC 3 ms 5760 KB
10_02.txt AC 3 ms 5760 KB
10_03.txt AC 3 ms 5760 KB
10_04.txt AC 3 ms 5760 KB
10_05.txt AC 3 ms 5760 KB
10_06.txt AC 3 ms 5760 KB
10_07.txt AC 3 ms 5888 KB
10_08.txt AC 5 ms 6016 KB
10_09.txt AC 5 ms 6016 KB
10_10.txt AC 5 ms 6016 KB
10_11.txt AC 5 ms 6016 KB
10_12.txt AC 5 ms 6016 KB
10_13.txt AC 4 ms 6016 KB
10_14.txt AC 4 ms 6016 KB
10_15.txt AC 4 ms 6016 KB
10_16.txt AC 4 ms 6016 KB
10_17.txt AC 4 ms 6016 KB
20_01.txt AC 110 ms 19200 KB
20_02.txt AC 113 ms 19200 KB
20_03.txt AC 117 ms 19200 KB
20_04.txt AC 19 ms 7040 KB
20_05.txt AC 4 ms 5888 KB
20_06.txt AC 17 ms 14208 KB
20_07.txt AC 5 ms 5888 KB
20_08.txt AC 23 ms 5888 KB
20_09.txt AC 4 ms 5888 KB
20_10.txt AC 18 ms 5760 KB
20_11.txt AC 24 ms 6016 KB
20_12.txt AC 78 ms 17152 KB
20_13.txt AC 97 ms 17280 KB
20_14.txt AC 105 ms 17152 KB
20_15.txt AC 80 ms 19704 KB
20_16.txt AC 79 ms 19960 KB