Submission #785598

# Submission time Handle Problem Language Result Execution time Memory
785598 2023-07-17T10:31:23 Z kebine Sprinkler (JOI22_sprinkler) C++17
0 / 100
202 ms 17412 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(h[x] == 0ll or jarak > batas) 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] *= w;
            h[x] %= l;
            for(auto it : adj[x])
            {
                h[it] *= w;
                h[it] %= l;
            }
        }
        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 2 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 158 ms 17412 KB Output is correct
3 Correct 202 ms 14252 KB Output is correct
4 Incorrect 177 ms 14776 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 158 ms 17412 KB Output is correct
3 Correct 202 ms 14252 KB Output is correct
4 Incorrect 177 ms 14776 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4908 KB Output is correct
2 Incorrect 154 ms 15712 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 2 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -