Submission #803310

# Submission time Handle Problem Language Result Execution time Memory
803310 2023-08-03T04:08:25 Z 반딧불(#10100) Vera and Modern Art (CCO17_art) C++17
0 / 25
4000 ms 8116 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[i] && qy>=py[i]) 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);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4018 ms 8116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -