답안 #164734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164734 2019-11-23T05:22:46 Z ho94949 Examination (JOI19_examination) C++17
2 / 100
3000 ms 4492 KB
#include<bits/stdc++.h>
#include<immintrin.h>
#include<smmintrin.h>
#pragma GCC target("avx2,sse4")
using namespace std;
int N, Q;
int S[100004], T[100004], U[100004];
int x[8], y[8], z[8], b[8];
int main()
{
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> N >> Q;
    for(int i=0; i<N; ++i)
    {
        cin >> S[i] >> T[i];
        U[i] = S[i] + T[i];
    }
    int rawN = N;
    N = (N+7)>>3;
    for(int i=0; i<Q; ++i)
    {
        int X, Y, Z;
        cin >> X >> Y >> Z;
        if(X==0&&Y==0&&Z==0)
        {
            cout << rawN << '\n';
            continue;
        }
        for(int j=0; j<8; ++j) x[j]=X,y[j]=Y,z[j]=Z;

        __m256i ans = _mm256_load_si256((__m256i*)b);
        __m256i xv = _mm256_load_si256((__m256i*)x);
        __m256i yv = _mm256_load_si256((__m256i*)y);
        __m256i zv = _mm256_load_si256((__m256i*)z);

        int ansv = N << 3;
        for(int j=0; j<N; ++j)
        {
            __m256i sv = _mm256_load_si256( ((__m256i*)S)+j);
            __m256i tv = _mm256_load_si256( ((__m256i*)T)+j);
            __m256i uv = _mm256_load_si256( ((__m256i*)U)+j);
            __m256i sx = _mm256_cmpgt_epi32(xv, sv); //xv>sv
            __m256i ty = _mm256_cmpgt_epi32(yv, tv); //yv>tv
            __m256i uz = _mm256_cmpgt_epi32(zv, uv); //zv>uv
            __m256i st = _mm256_or_si256(sx, ty);
            __m256i av = _mm256_or_si256(st, uz);
            ans = _mm256_add_epi32(ans, av);
        }
        __m256i ans2 = ans;
        int* av = (int*)&ans2;
        for(int i=0; i<8; ++i) ansv += av[i];
        cout << ansv << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 7 ms 504 KB Output is correct
8 Correct 7 ms 632 KB Output is correct
9 Correct 7 ms 632 KB Output is correct
10 Correct 6 ms 504 KB Output is correct
11 Correct 6 ms 632 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 632 KB Output is correct
14 Correct 7 ms 508 KB Output is correct
15 Correct 7 ms 504 KB Output is correct
16 Correct 6 ms 504 KB Output is correct
17 Correct 6 ms 504 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3014 ms 4492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3014 ms 4492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 7 ms 504 KB Output is correct
8 Correct 7 ms 632 KB Output is correct
9 Correct 7 ms 632 KB Output is correct
10 Correct 6 ms 504 KB Output is correct
11 Correct 6 ms 632 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 632 KB Output is correct
14 Correct 7 ms 508 KB Output is correct
15 Correct 7 ms 504 KB Output is correct
16 Correct 6 ms 504 KB Output is correct
17 Correct 6 ms 504 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Execution timed out 3014 ms 4492 KB Time limit exceeded
20 Halted 0 ms 0 KB -