Submission #785234

# Submission time Handle Problem Language Result Execution time Memory
785234 2023-07-17T07:27:28 Z andecaandeci Sprinkler (JOI22_sprinkler) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define keish                             ios_base::sync_with_stdio(0);       cin.tie(0); cout.tie(0)
      
using namespace std;

int n, l, q, u, v, t, x, d, w;

signed main(){
      keish;
      cin >> n >> l;
      vector<vector<int>> e(n);
      for(int i = 1; i < n; i++){
            cin >> u >> v; u--, v--;
            e[u].push_back(v);
            e[v].push_back(u);
      }

      vector<int> a(n);
      for(auto &x : a) cin >> x;
      
      // function<void(int, int, int)> dfs = [&](int u, int p, int d){

      // };
      
      cin >> q;
      while(q--){
            cin >> t;
            if(t == 1){
                  cin >> x >> d >> w; x--;
                  if(d == 0){
                        (a[x] *= w) %= l;
                  }else{
                        for(auto i : e[x]){
                              (a[i] *= w) %= l;
                        }
                  }
            }else{      
                  cin >> x; x--;
                  cout << a[x] << '\n';
            }
      }
}     
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -