-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (38 loc) · 917 Bytes
/
main.cpp
File metadata and controls
38 lines (38 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "database.hpp"
#include <iostream>
#include "vector.hpp"
int main ()
{
// freopen("test.in","r",stdin);
// freopen("my.out","w",stdout);
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
int n;
std::cin>>n;
std::string s;
char index[65];
int value;
database<int> db("data");
for(int i=1;i<=n;i++){
std::cin>>s>>index;
if(s=="insert"){
std::cin>>value;
db.insert(index,value);
}
if(s=="delete"){
std::cin>>value;
db.erase(index,value);
}
if(s=="find"){
sjtu::vector<int> ans=db.find(index);
if(ans.empty()){
std::cout<<"null\n";
continue;
}
for(int i=0;i<ans.size();i++)std::cout<<ans[i]<<' ';
std::cout<<'\n';
}
}
return 0;
}