提出 #60323598


ソースコード 拡げる

// I AM A MUSLIM

#include "bits/stdc++.h"

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#define fast_io std::ios::sync_with_stdio(0);std::cin.tie(0)
#define lli long long int
#define flush fflush(stdout)
#define new_line printf("\n")
#define yn(a, b) printf("%s\n", a >= b ? "Yes":"No")
#define safe_mod(a, M) ((a%M+M)%M)
// #define int lli

using pii = std::pair<int,int>;

const int MOD = 1000000007;
const int mxN = 100100;

signed main() {
    int testCases=1;
    // scanf("%d",&testCases);
    
    for (int TC = 1; TC <= testCases; TC++) {
        int n, m;
        scanf("%d%d",&n,&m);
        int ans[m]; memset(ans,-1,sizeof ans);
        std::vector<pii> al;
        std::vector<int> a(n); for (auto &i : a) scanf("%d",&i);
        for (int i = 0, v; i < m; i++) {
            scanf("%d",&v);
            al.push_back(pii(v, i));
        }
        
        sort(al.begin(), al.end());
        int lim = m;
        
        for (int i = 0; i < n; i++) {
            int v = a[i];
            auto it = lower_bound(al.begin(), al.begin()+lim, pii(v, -1));
            if (it != al.end()) {
                int at = it-al.begin();
                for (int j = at; j < lim; j++) ans[al[j].second] = i+1;
                lim = at;
                // printf("%d %d\n", i, lim);
            }
        }
        
        for (int i = 0; i < m; i++) printf("%d\n", ans[i]);
        // new_line;
        
    }
    
    return 0;
}

/*

*/

提出情報

提出日時
問題 C - Kaiten Sushi
ユーザ MArhamAA1422
言語 C++ 20 (Clang 16.0.6)
得点 350
コード長 1545 Byte
結果 AC
実行時間 66 ms
メモリ 7024 KiB

コンパイルエラー

./Main.cpp:5:13: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma GCC optimize("O3,unroll-loops")
            ^
./Main.cpp:6:13: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
            ^
./Main.cpp:18:11: warning: unused variable 'MOD' [-Wunused-const-variable]
const int MOD = 1000000007;
          ^
./Main.cpp:19:11: warning: unused variable 'mxN' [-Wunused-const-variable]
const int mxN = 100100;
          ^
4 warnings generated.

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 350 / 350
結果
AC × 3
AC × 30
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 02_random2_16.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3628 KiB
00_sample_01.txt AC 1 ms 3740 KiB
00_sample_02.txt AC 1 ms 3628 KiB
01_random_00.txt AC 25 ms 4804 KiB
01_random_01.txt AC 12 ms 4304 KiB
01_random_02.txt AC 43 ms 6428 KiB
01_random_03.txt AC 50 ms 6804 KiB
01_random_04.txt AC 29 ms 4988 KiB
02_random2_00.txt AC 63 ms 7024 KiB
02_random2_01.txt AC 65 ms 6980 KiB
02_random2_02.txt AC 65 ms 6860 KiB
02_random2_03.txt AC 65 ms 7020 KiB
02_random2_04.txt AC 65 ms 6872 KiB
02_random2_05.txt AC 65 ms 6908 KiB
02_random2_06.txt AC 65 ms 6936 KiB
02_random2_07.txt AC 65 ms 6884 KiB
02_random2_08.txt AC 66 ms 6908 KiB
02_random2_09.txt AC 64 ms 6984 KiB
02_random2_10.txt AC 64 ms 6908 KiB
02_random2_11.txt AC 64 ms 6872 KiB
02_random2_12.txt AC 63 ms 6804 KiB
02_random2_13.txt AC 63 ms 6792 KiB
02_random2_14.txt AC 63 ms 6868 KiB
02_random2_15.txt AC 63 ms 7020 KiB
02_random2_16.txt AC 62 ms 6888 KiB
03_handmade_00.txt AC 42 ms 6916 KiB
03_handmade_01.txt AC 36 ms 6792 KiB
03_handmade_02.txt AC 25 ms 6100 KiB
03_handmade_03.txt AC 26 ms 6228 KiB
03_handmade_04.txt AC 1 ms 3740 KiB