제출 #1349493

#제출 시각아이디문제언어결과실행 시간메모리
1349493mishasimVera and Modern Art (CCO17_art)C++20
5 / 25
4094 ms5128 KiB
#include <iostream>

using namespace std;
#define endl '\n'
long long x1,y1,n,q;
long long x[200005],y[200005],v[200005];
long long step(long long nn){
    long long res1 = 1;
    for(int i = 1 ; i<=nn ; i++)res1*=2;
    return res1;
}
long long log(long long nn){
    long long ress = 0;
    while(nn>=2){
        nn/=2;
        ress++;
    }
    return ress;
}

long long query(long long x1, long long y1){
    long long res = 0;
    for(int i = 1 ; i<=n ; i++){
        if((x1-x[i])%step(log(x[i]))==0 && (y1-y[i])%step(log(y[i]))==0 && x1-x[i]>=0 && y1-y[i]>=0)res+=v[i];
    }

    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>q;
    for(int i = 1 ; i<=n ; i++){
        cin>>x[i]>>y[i]>>v[i];
    }
    for(int i = 1 ; i<=q ; i++){
        cin>>x1>>y1;
        cout<<query(x1,y1)<<endl;
    }

    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:5:14: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
    5 | long long x1,y1,n,q;
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...