답안 #803296

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
803296 2023-08-03T04:05:12 Z 반딧불(#10100) Vera and Modern Art (CCO17_art) C++17
0 / 25
4000 ms 8440 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, q;
ll px[200002], py[200002], pa[200002], pb[200002], pv[200002];

int main(){
    scanf("%d %d", &n, &q);
    for(int i=1; i<=n; i++){
        scanf("%lld %lld %lld", &px[i], &py[i], &pv[i]);
        pa[i] = 1, pb[i] = 1;
        while(pa[i] * 2 <= px[i]) pa[i]*=2;
        while(pb[i] * 2 <= py[i]) pb[i]*=2;
    }
    for(int i=1; i<=q; i++){
        ll qx, qy;
        scanf("%lld %lld", &qx, &qy);

        ll ans = 0;
        for(int i=1; i<=n; i++){
            if((qx - px[i]) % pa[i] == 0 && (qy - py[i]) % pb[i] == 0) ans += pv[i];
        }
        printf("%lld\n", ans);
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%lld %lld %lld", &px[i], &py[i], &pv[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%lld %lld", &qx, &qy);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 20 ms 460 KB Output is correct
3 Correct 20 ms 428 KB Output is correct
4 Correct 41 ms 464 KB Output is correct
5 Correct 40 ms 408 KB Output is correct
6 Incorrect 28 ms 420 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4056 ms 8440 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Execution timed out 4086 ms 4496 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 20 ms 460 KB Output is correct
3 Correct 20 ms 428 KB Output is correct
4 Correct 41 ms 464 KB Output is correct
5 Correct 40 ms 408 KB Output is correct
6 Incorrect 28 ms 420 KB Output isn't correct
7 Halted 0 ms 0 KB -