提出 #65646326
ソースコード 拡げる
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define debug(x) cerr << (#x) << " " << (x) << endl #define SZ(s) ((int)s.size()) #define pb push_back #define ff first #define ss second #define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using vi = vector<int>; const int MOD = 998244353; const int N = 3e5 + 100; const int MASSIVE = 1e18; void solve(int test_case) { int n, m; cin >> n >> m; vi a(n); map<int, int> mp; for(int &x : a) cin >> x, mp[x] ++; reverse(all(a)); for(int i = 1; i <= m; i ++){ if(!mp[i]) return cout << 0, void(); } for(int i = 0; i < n; i ++){ if(mp[a[i]] == 1) return cout << i + 1, void(); else mp[a[i]] --; } cout << n; } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; for (int i = 1; i <= t; i++) { solve(i); cout << "\n"; //cerr << "_________________________________________\n"; } return 0; }
提出情報
提出日時 | |
---|---|
問題 | B - Not All |
ユーザ | batman3737 |
言語 | C++ 20 (gcc 12.2) |
得点 | 200 |
コード長 | 1097 Byte |
結果 | AC |
実行時間 | 1 ms |
メモリ | 3580 KiB |
コンパイルエラー
Main.cpp: In function ‘void solve(long long int)’: Main.cpp:18:16: warning: unused parameter ‘test_case’ [-Wunused-parameter] 18 | void solve(int test_case) { | ^
ジャッジ結果
セット名 | Sample | All | ||||
---|---|---|---|---|---|---|
得点 / 配点 | 0 / 0 | 200 / 200 | ||||
結果 |
|
|
セット名 | テストケース |
---|---|
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, 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, 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 | 3416 KiB |
00_sample_01.txt | AC | 1 ms | 3488 KiB |
00_sample_02.txt | AC | 1 ms | 3408 KiB |
01_random_00.txt | AC | 1 ms | 3580 KiB |
01_random_01.txt | AC | 1 ms | 3344 KiB |
01_random_02.txt | AC | 1 ms | 3480 KiB |
01_random_03.txt | AC | 1 ms | 3408 KiB |
02_random2_00.txt | AC | 1 ms | 3468 KiB |
02_random2_01.txt | AC | 1 ms | 3556 KiB |
02_random2_02.txt | AC | 1 ms | 3540 KiB |
02_random2_03.txt | AC | 1 ms | 3400 KiB |
02_random2_04.txt | AC | 1 ms | 3556 KiB |
02_random2_05.txt | AC | 1 ms | 3480 KiB |
02_random2_06.txt | AC | 1 ms | 3544 KiB |
02_random2_07.txt | AC | 1 ms | 3428 KiB |
03_handmade_00.txt | AC | 1 ms | 3464 KiB |
03_handmade_01.txt | AC | 1 ms | 3472 KiB |
03_handmade_02.txt | AC | 1 ms | 3480 KiB |
03_handmade_03.txt | AC | 1 ms | 3344 KiB |
03_handmade_04.txt | AC | 1 ms | 3424 KiB |