Submission #40691457
Source Code Expand
#include <iostream>
#include <set>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
int n;
scanf("%d", &n);
constexpr int CARD_MAX = 2e5;
vector<multiset<int>> v1(n + 1); // v1[i]:=箱iに入っているカード
vector<set<int>> v2(CARD_MAX + 1); //v2[i]:=数字iの書かれたカードが入っている箱のID
int q;
scanf("%d", &q);
while (q--) {
int t;
scanf("%d", &t);
if (t == 1) {
int i,j;
scanf("%d%d", &i, &j);
v1[j].emplace(i);
v2[i].emplace(j);
} else if (t == 2) {
int i;
scanf("%d", &i);
for (const auto& card : v1[i]) {
printf("%d ", card);
}
printf("\n");
} else {
int i;
scanf("%d", &i);
for (const auto& box : v2[i]) {
printf("%d ", box);
}
printf("\n");
}
}
}
Submission Info
Submission Time |
|
Task |
C - Cards Query Problem |
User |
AC2K |
Language |
C++ (GCC 9.2.1) |
Score |
300 |
Code Size |
1051 Byte |
Status |
AC |
Exec Time |
141 ms |
Memory |
37024 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
8 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
./Main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
15 | scanf("%d", &q);
| ~~~~~^~~~~~~~~~
./Main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
18 | scanf("%d", &t);
| ~~~~~^~~~~~~~~~
./Main.cpp:21:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
21 | scanf("%d%d", &i, &j);
| ~~~~~^~~~~~~~~~~~~~~~
./Main.cpp:26:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
26 | scanf("%d", &i);
| ~~~~~^~~~~~~~~~
./Main.cpp:34:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
34 | scanf("%d", &i);
| ~~~~~^~~~~~~~~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample00.txt, sample01.txt |
All |
sample00.txt, sample01.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt |
Case Name |
Status |
Exec Time |
Memory |
sample00.txt |
AC |
13 ms |
12692 KiB |
sample01.txt |
AC |
10 ms |
12484 KiB |
testcase00.txt |
AC |
110 ms |
31456 KiB |
testcase01.txt |
AC |
92 ms |
31436 KiB |
testcase02.txt |
AC |
33 ms |
21456 KiB |
testcase03.txt |
AC |
45 ms |
22764 KiB |
testcase04.txt |
AC |
38 ms |
21720 KiB |
testcase05.txt |
AC |
44 ms |
23056 KiB |
testcase06.txt |
AC |
41 ms |
22204 KiB |
testcase07.txt |
AC |
66 ms |
24344 KiB |
testcase08.txt |
AC |
121 ms |
29016 KiB |
testcase09.txt |
AC |
66 ms |
23740 KiB |
testcase10.txt |
AC |
39 ms |
22208 KiB |
testcase11.txt |
AC |
70 ms |
25320 KiB |
testcase12.txt |
AC |
129 ms |
30376 KiB |
testcase13.txt |
AC |
61 ms |
24084 KiB |
testcase14.txt |
AC |
39 ms |
22232 KiB |
testcase15.txt |
AC |
70 ms |
25140 KiB |
testcase16.txt |
AC |
130 ms |
30444 KiB |
testcase17.txt |
AC |
63 ms |
24380 KiB |
testcase18.txt |
AC |
124 ms |
36216 KiB |
testcase19.txt |
AC |
118 ms |
35732 KiB |
testcase20.txt |
AC |
123 ms |
36488 KiB |
testcase21.txt |
AC |
122 ms |
36180 KiB |
testcase22.txt |
AC |
141 ms |
36744 KiB |
testcase23.txt |
AC |
127 ms |
37008 KiB |
testcase24.txt |
AC |
128 ms |
37008 KiB |
testcase25.txt |
AC |
126 ms |
37016 KiB |
testcase26.txt |
AC |
122 ms |
37024 KiB |
testcase27.txt |
AC |
128 ms |
37008 KiB |