Submission #785445

# Submission time Handle Problem Language Result Execution time Memory
785445 2023-07-17T09:10:56 Z makanhulia Sprinkler (JOI22_sprinkler) C++17
0 / 100
181 ms 13716 KB
#include<bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long, long long>
// jangan kebiasa kalah
// kalo OI, sampah aja dulu, tapi jangan menutup kemungkinan buat AC

long long n,l,tc,h[200069],level[200069],parent_node[200069];
vector<long long> adj[200069];

void dfs(long long x, long long p, long long jarak, long long batas)
{
    if(jarak > batas or h[x] == 0ll) return;
    h[x] = 0ll;
    for(auto j : adj[x])
    {
        if(j == p) continue;
        dfs(j,x,jarak+1,batas);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    long long i,j;
    cin>>n>>l;
    for(i=1;i<n;i++)
    {
        long long u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(i=1;i<=n;i++)
    {
        cin>>h[i];
    }
    cin>>tc;
    while(tc--)
    {
        int typ;
        long long x,d,w;
        cin>>typ;
        if(typ == 1)
        {
            cin>>x>>d>>w;
            h[x] = 0ll;
            for(auto it : adj[x])
            {
                dfs(it,x,1,d);
            }
        }
        else
        {
            cin>>x;
            cout<<h[x]<<'\n';
        }
    }
}

Compilation message

sprinkler.cpp: In function 'int main()':
sprinkler.cpp:29:17: warning: unused variable 'j' [-Wunused-variable]
   29 |     long long i,j;
      |                 ^
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Incorrect 181 ms 13716 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -