Submission #359318

# Submission time Handle Problem Language Result Execution time Memory
359318 2021-01-26T18:18:14 Z jhnah917 Examination (JOI19_examination) C++14
2 / 100
3000 ms 2028 KB
/******************************
Author: jhnah917(Justice_Hui)
g++ -std=c++17 -DLOCAL
******************************/

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx,avx2,fma")

#include <bits/stdc++.h>
#include <immintrin.h>
using namespace std;

using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
constexpr int SZ = 100000;

union Fuck{
    __m256i vec;
    int arr[8];
};

int N, Q;
alignas(256) Fuck S[SZ/8], T[SZ/8], U[SZ/8], Flags;

__m256i _mm256_cmpgeq_epi32(__m256i a, __m256i b){
    __m256i ret = _mm256_cmpeq_epi32(a, b);
    ret = _mm256_or_si256(ret, _mm256_cmpgt_epi32(a, b));
    return ret;
}

__m256i _mm256_cmpgeq_epi32(__m256i a, unsigned b){
    return _mm256_cmpgeq_epi32(a, _mm256_set1_epi32(b));
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    cin >> N >> Q;
    for(int i=0; i<SZ/8; i++) S[i].vec = T[i].vec = _mm256_set1_epi32(-1e9);
    for(int i=0; i<N; i++) cin >> S[i>>3].arr[i&7] >> T[i>>3].arr[i&7];
    for(int i=0; i<SZ/8; i++){
        U[i].vec = _mm256_add_epi32(S[i].vec, T[i].vec);
    }

    for(int i=0; i<Q; i++){
        int x, y, z, ans = 0; cin >> x >> y >> z;
        Fuck cnt; cnt.vec = _mm256_set1_epi32(0);
        for(int j=0; j<SZ/8; j++){
            __m256i X = _mm256_cmpgeq_epi32(S[j].vec, x);
            __m256i Y = _mm256_cmpgeq_epi32(T[j].vec, y);
            __m256i Z = _mm256_cmpgeq_epi32(U[j].vec, z);
            Flags.vec = _mm256_and_si256(_mm256_and_si256(X, _mm256_and_si256(Y, Z)), _mm256_set1_epi32(1));
            cnt.vec = _mm256_add_epi32(cnt.vec, Flags.vec);
        }
        for(int j=0; j<8; j++) ans += cnt.arr[j];
        cout << ans << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1516 KB Output is correct
2 Correct 2 ms 1516 KB Output is correct
3 Correct 2 ms 1516 KB Output is correct
4 Correct 3 ms 1516 KB Output is correct
5 Correct 2 ms 1516 KB Output is correct
6 Correct 2 ms 1516 KB Output is correct
7 Correct 130 ms 1772 KB Output is correct
8 Correct 132 ms 1644 KB Output is correct
9 Correct 127 ms 1516 KB Output is correct
10 Correct 126 ms 1644 KB Output is correct
11 Correct 128 ms 1516 KB Output is correct
12 Correct 133 ms 1644 KB Output is correct
13 Correct 133 ms 1516 KB Output is correct
14 Correct 128 ms 1644 KB Output is correct
15 Correct 133 ms 1516 KB Output is correct
16 Correct 130 ms 1516 KB Output is correct
17 Correct 135 ms 1644 KB Output is correct
18 Correct 127 ms 1644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3059 ms 2028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3059 ms 2028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1516 KB Output is correct
2 Correct 2 ms 1516 KB Output is correct
3 Correct 2 ms 1516 KB Output is correct
4 Correct 3 ms 1516 KB Output is correct
5 Correct 2 ms 1516 KB Output is correct
6 Correct 2 ms 1516 KB Output is correct
7 Correct 130 ms 1772 KB Output is correct
8 Correct 132 ms 1644 KB Output is correct
9 Correct 127 ms 1516 KB Output is correct
10 Correct 126 ms 1644 KB Output is correct
11 Correct 128 ms 1516 KB Output is correct
12 Correct 133 ms 1644 KB Output is correct
13 Correct 133 ms 1516 KB Output is correct
14 Correct 128 ms 1644 KB Output is correct
15 Correct 133 ms 1516 KB Output is correct
16 Correct 130 ms 1516 KB Output is correct
17 Correct 135 ms 1644 KB Output is correct
18 Correct 127 ms 1644 KB Output is correct
19 Execution timed out 3059 ms 2028 KB Time limit exceeded
20 Halted 0 ms 0 KB -