답안 #785595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
785595 2023-07-17T10:30:19 Z andecaandeci Sprinkler (JOI22_sprinkler) C++17
0 / 100
791 ms 17304 KB
#include<bits/stdc++.h>
 
#define sherina ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define int long long
#define INF 1e18
#define endl '\n'
 
using namespace std;

int n , l , a , b , h[200005] , q , t , x , d , w, dist[20005];
vector < int > adj[200005];
bool vis[200005];
vector <int > v;

void bfs(int s){
   vis[s] = true;
   queue < int > q;
   q.push(s);
   while(!q.empty()){
      int u = q.front(); q.pop();
      v.pb(u);
      for(int j = 0 ; j < adj[u].size() ; j++){
         int i = adj[u][j];
         if(vis[i]) continue;
         if(dist[u] == d) continue;
         dist[i] = dist[u] + 1;
         vis[i] = true;
         q.push(i);
      }
   }
}

signed main(){
   cin >> n >> l;
   for(int i = 1 ; i < n ; i++){
      cin >> a >> b;
      adj[a].pb(b);
      adj[b].pb(a);
   }
   for(int i = 1 ; i <= n ; i++) cin >> h[i];
   cin >> q;
   while(q--){
      cin >> t;
      if(t == 1){
         cin >> x >> d >> w;
         h[x] = (h[x] * w) % l;
         for(int i : adj[x]){
            h[i] = (h[i] * w) % l;
         }
      }
      else{
         cin >> x;
         cout << h[x] << endl;
      }
   }
}

Compilation message

sprinkler.cpp: In function 'void bfs(long long int)':
sprinkler.cpp:23:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |       for(int j = 0 ; j < adj[u].size() ; j++){
      |                       ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 791 ms 17304 KB Output is correct
3 Correct 602 ms 14264 KB Output is correct
4 Incorrect 681 ms 14664 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 791 ms 17304 KB Output is correct
3 Correct 602 ms 14264 KB Output is correct
4 Incorrect 681 ms 14664 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Incorrect 774 ms 15744 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -