Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- const int maxn = 1e4 + 1;
- vector<int> S(maxn, 0), No(maxn, 0), U(maxn, 0);
- map<string, string> S2No, No2S;
- int main() {
- string a, op, b;
- while(cin >> a && a != "-1"){
- cin >> op >> b;
- if(a[0] == 'S') {
- if(op == "bind"){
- if(!S2No.count(a) && !No2S.count(b)){
- printf("%s bind success\n", a.c_str());
- S2No[a] = b;
- No2S[b] = a;
- continue;
- } else {
- printf("%s bind fail\n", a.c_str());
- continue;
- }
- } else if (op == "unbind"){
- if(S2No.count(a) && S2No[a] == b && No2S.count(b) && No2S[b] == a){
- printf("%s unbind success\n", a.c_str());
- S2No.erase(a);
- No2S.erase(b);
- continue;
- } else {
- printf("%s unbind fail\n", a.c_str());
- continue;
- }
- } else {
- printf("unknow command\n");
- continue;
- }
- } else if (a[0] == 'U') {
- if(op == "scan"){
- if(No2S.count(b)){
- printf("%s pay to %s\n", a.c_str(), No2S[b].c_str());
- continue;
- } else {
- printf("%s scan fail\n", a.c_str());
- continue;
- }
- } else {
- printf("unknow command\n");
- continue;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement