提出 #60393185


ソースコード 拡げる

#include<bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define eb emplace_back
#define LC k<<1
#define RC k<<1|1
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repn(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = (n) - 1; i >= a; i--)
#define pern(i, a, n) for (int i = n; i >= a; i--)

typedef long long LL;
typedef long double LD;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<int, LL> PIL;
typedef pair<LL, int> PLI;
typedef pair<double, double> PDD;
typedef pair<ull, ull> PUU;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<PII> VPII;
typedef vector<vector<int>> VVI;

const int N = 210000;
const int M = 1100000;
const int mod = 1e9+7;
const int inf = (int)1e9;
const LL INF = 1e18;
const double eps = 1e-9;

mt19937_64 Rand((unsigned long long)new char);
#define rand Rand

int n, m, a[N], ans[N];
PII b[N];
int main() {
    IO;
    cin >> n >> m;
    repn(i, 1, n) cin >> a[i];
    repn(i, 1, m) cin >> b[i].fi, b[i].se = i, ans[i] = -1;
    sort(b + 1, b + m + 1);
    reverse(b + 1, b + m + 1);
    int cur = 0;
    repn(i, 1, n) {
        while (cur + 1 <= m && b[cur + 1].fi >= a[i]) {
            cur++;
            ans[b[cur].se] = i;
        }
    }
    repn(i, 1, m) cout << ans[i] << "\n";
    return 0;
}

提出情報

提出日時
問題 C - Kaiten Sushi
ユーザ cxaphoenix
言語 C++ 20 (gcc 12.2)
得点 350
コード長 1587 Byte
結果 AC
実行時間 47 ms
メモリ 6732 KiB

ジャッジ結果

セット名 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 3396 KiB
00_sample_01.txt AC 1 ms 3532 KiB
00_sample_02.txt AC 1 ms 3392 KiB
01_random_00.txt AC 18 ms 4740 KiB
01_random_01.txt AC 8 ms 4056 KiB
01_random_02.txt AC 32 ms 5744 KiB
01_random_03.txt AC 36 ms 6080 KiB
01_random_04.txt AC 21 ms 4988 KiB
02_random2_00.txt AC 44 ms 6600 KiB
02_random2_01.txt AC 46 ms 6576 KiB
02_random2_02.txt AC 46 ms 6560 KiB
02_random2_03.txt AC 47 ms 6480 KiB
02_random2_04.txt AC 47 ms 6540 KiB
02_random2_05.txt AC 46 ms 6540 KiB
02_random2_06.txt AC 47 ms 6536 KiB
02_random2_07.txt AC 46 ms 6604 KiB
02_random2_08.txt AC 47 ms 6552 KiB
02_random2_09.txt AC 46 ms 6596 KiB
02_random2_10.txt AC 46 ms 6732 KiB
02_random2_11.txt AC 46 ms 6604 KiB
02_random2_12.txt AC 46 ms 6556 KiB
02_random2_13.txt AC 46 ms 6596 KiB
02_random2_14.txt AC 46 ms 6724 KiB
02_random2_15.txt AC 47 ms 6664 KiB
02_random2_16.txt AC 46 ms 6552 KiB
03_handmade_00.txt AC 28 ms 6604 KiB
03_handmade_01.txt AC 27 ms 6544 KiB
03_handmade_02.txt AC 21 ms 5824 KiB
03_handmade_03.txt AC 20 ms 5752 KiB
03_handmade_04.txt AC 1 ms 3424 KiB