제출 #359304

#제출 시각아이디문제언어결과실행 시간메모리
359304jhnah917Examination (JOI19_examination)C++14
2 / 100
3063 ms4040 KiB
/******************************
Author: jhnah917(Justice_Hui)
g++ -std=c++17 -DLOCAL
******************************/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2,fma")

#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define IDX(v, x) lower_bound(all(v), x) - v.begin()
using namespace std;

using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
constexpr int SZ = 1 << 17;

int N, Q;
alignas(256) int S[SZ], T[SZ], Sum[SZ];
alignas(256) char Flags[SZ];

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    cin >> N >> Q;
    for(int i=1; i<=N; i++) cin >> S[i] >> T[i];
    for(int i=1; i<=N; i++) Sum[i] = S[i] + T[i];
    for(int i=1; i<=Q; i++){
        int x, y, z, ans = 0; cin >> x >> y >> z;
        memset(Flags+1, 0, sizeof(char) * N);
        for(int j=1; j<=N; j++) if(S[j] >= x) Flags[j] |= 1;
        for(int j=1; j<=N; j++) if(T[j] >= y) Flags[j] |= 2;
        for(int j=1; j<=N; j++) if(Sum[j] >= z) Flags[j] |= 4;
        for(int j=1; j<=N; j++) ans += Flags[j] == 7;
        cout << ans << "\n";
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...