Submission #785628

# Submission time Handle Problem Language Result Execution time Memory
785628 2023-07-17T10:54:12 Z kebine Sprinkler (JOI22_sprinkler) C++17
0 / 100
4000 ms 17416 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;

      cin >> q;
      while(q--){
            cin >> t;
            if(t == 1){
                  cin >> x >> d >> w; x--;
                  (a[x] *= w) %= l;
                  if(d == 1){
                        for(auto v : e[x]){
                              (a[v] *= w) %= l;
                        }
                  }
            }else{      
                  cin >> x; x--;
                  cout << a[x] << '\n';
            }
      }
}  
# 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 Correct 0 ms 212 KB Output is correct
2 Correct 157 ms 17416 KB Output is correct
3 Correct 200 ms 14212 KB Output is correct
4 Correct 160 ms 14664 KB Output is correct
5 Correct 197 ms 15792 KB Output is correct
6 Correct 175 ms 15812 KB Output is correct
7 Correct 168 ms 16140 KB Output is correct
8 Correct 157 ms 16364 KB Output is correct
9 Correct 147 ms 16192 KB Output is correct
10 Correct 209 ms 13216 KB Output is correct
11 Correct 150 ms 17356 KB Output is correct
12 Correct 199 ms 14156 KB Output is correct
13 Execution timed out 4049 ms 14276 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 157 ms 17416 KB Output is correct
3 Correct 200 ms 14212 KB Output is correct
4 Correct 160 ms 14664 KB Output is correct
5 Correct 197 ms 15792 KB Output is correct
6 Correct 175 ms 15812 KB Output is correct
7 Correct 168 ms 16140 KB Output is correct
8 Correct 157 ms 16364 KB Output is correct
9 Correct 147 ms 16192 KB Output is correct
10 Correct 209 ms 13216 KB Output is correct
11 Correct 150 ms 17356 KB Output is correct
12 Correct 199 ms 14156 KB Output is correct
13 Execution timed out 4049 ms 14276 KB Time limit exceeded
14 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 232 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 -