답안 #803316

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
803316 2023-08-03T04:09:30 Z 반딧불(#10100) Vera and Modern Art (CCO17_art) C++17
5 / 25
4000 ms 8120 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 j=1; j<=n; j++){
            if((qx - px[j]) % pa[j] == 0 && (qy - py[j]) % pb[j] == 0 && qx>=px[j] && qy>=py[j]) ans += pv[j];
        }
        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 19 ms 340 KB Output is correct
3 Correct 21 ms 420 KB Output is correct
4 Correct 39 ms 412 KB Output is correct
5 Correct 39 ms 420 KB Output is correct
6 Correct 27 ms 416 KB Output is correct
7 Correct 27 ms 340 KB Output is correct
8 Correct 27 ms 420 KB Output is correct
9 Correct 28 ms 340 KB Output is correct
10 Correct 26 ms 428 KB Output is correct
11 Correct 27 ms 416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4074 ms 8120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Execution timed out 4080 ms 4244 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 19 ms 340 KB Output is correct
3 Correct 21 ms 420 KB Output is correct
4 Correct 39 ms 412 KB Output is correct
5 Correct 39 ms 420 KB Output is correct
6 Correct 27 ms 416 KB Output is correct
7 Correct 27 ms 340 KB Output is correct
8 Correct 27 ms 420 KB Output is correct
9 Correct 28 ms 340 KB Output is correct
10 Correct 26 ms 428 KB Output is correct
11 Correct 27 ms 416 KB Output is correct
12 Execution timed out 4074 ms 8120 KB Time limit exceeded
13 Halted 0 ms 0 KB -