Submission #60317401
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;#define int long longsigned main() {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int n,m;cin >> n >> m;vector<int>a(n);for(auto &i : a) cin >> i;vector<pair<int,int>>b(m);for(int i = 0 ; i < m ; i++) {cin >> b[i].first;b[i].second = i;}sort(b.begin(),b.end());
#include<bits/stdc++.h> using namespace std; #define int long long signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,m; cin >> n >> m; vector<int>a(n); for(auto &i : a) cin >> i; vector<pair<int,int>>b(m); for(int i = 0 ; i < m ; i++) { cin >> b[i].first; b[i].second = i; } sort(b.begin(),b.end()); vector<int>vis(m,0); for(int i = 0 ; i < n ; i++) { pair<int,int>pp = {a[i],-1}; int x = lower_bound(b.begin(),b.end(),pp) - b.begin(); while(x < m && !vis[x]) { vis[x++] = i+1; } } vector<int>ans(m,0); for(int i = 0 ; i < m ; i++) { if(!vis[i]) { ans[b[i].second] = -1; } else { ans[b[i].second] = vis[i]; } } for(auto &u : ans) { cout << u << '\n'; } } // 1 2 5
Submission Info
Submission Time | |
---|---|
Task | C - Kaiten Sushi |
User | benzyl |
Language | C++ 20 (gcc 12.2) |
Score | 350 |
Code Size | 857 Byte |
Status | AC |
Exec Time | 71 ms |
Memory | 11056 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 350 / 350 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3404 KB |
00_sample_01.txt | AC | 1 ms | 3472 KB |
00_sample_02.txt | AC | 1 ms | 3528 KB |
01_random_00.txt | AC | 25 ms | 6200 KB |
01_random_01.txt | AC | 13 ms | 4580 KB |
01_random_02.txt | AC | 43 ms | 9156 KB |
01_random_03.txt | AC | 60 ms | 9668 KB |
01_random_04.txt | AC | 35 ms | 6672 KB |
02_random2_00.txt | AC | 68 ms | 10920 KB |
02_random2_01.txt | AC | 71 ms | 10900 KB |
02_random2_02.txt | AC | 71 ms | 11052 KB |
02_random2_03.txt | AC | 70 ms | 10944 KB |
02_random2_04.txt | AC | 68 ms | 11056 KB |
02_random2_05.txt | AC | 68 ms | 11036 KB |
02_random2_06.txt | AC | 69 ms | 10960 KB |
02_random2_07.txt | AC | 66 ms | 10952 KB |
02_random2_08.txt | AC | 68 ms | 10948 KB |
02_random2_09.txt | AC | 64 ms | 10912 KB |
02_random2_10.txt | AC | 66 ms | 11052 KB |
02_random2_11.txt | AC | 62 ms | 10920 KB |
02_random2_12.txt | AC | 63 ms | 10896 KB |
02_random2_13.txt | AC | 59 ms | 10992 KB |
02_random2_14.txt | AC | 60 ms | 10968 KB |
02_random2_15.txt | AC | 58 ms | 11056 KB |
02_random2_16.txt | AC | 55 ms | 10920 KB |
03_handmade_00.txt | AC | 40 ms | 10960 KB |
03_handmade_01.txt | AC | 38 ms | 10952 KB |
03_handmade_02.txt | AC | 22 ms | 9288 KB |
03_handmade_03.txt | AC | 23 ms | 9388 KB |
03_handmade_04.txt | AC | 1 ms | 3308 KB |