-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBus_full_of_passengers.cpp
More file actions
80 lines (70 loc) · 1.56 KB
/
Bus_full_of_passengers.cpp
File metadata and controls
80 lines (70 loc) · 1.56 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include<bits/stdc++.h>
#define null NULL
#define ll long long int>
#define mod 1000000007
#define minh priority_queue<int,vector<int>,greater<int>> minh
#define maxh priority_queue<int> maxh
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
while(t--)
{
int n,m,q;
cin>>n>>m>>q;
char x;
int a,count=0,ch=0;
vector<int>v;
int ans=0;
for(int i=0;i<q;i++)
{
cin>>x>>a;
if(x=='+')
{
v.push_back(a);
count++;
}
else
{
for(int j=0;j<v.size();j++)
{
cout<<v[j]<<" ";
if(v[j]==a)
{
count--;
v.erase(v.begin()+j);
ans=0;
break;
}
else
{
//cout<<"aman";
ans=1;
}
}
}
//cout<<count<<" ";
if(count>m || ans==1)
{
ch=1;
//cout<<"kumar";
break;
}
}
if(ch==1)
{
cout<<"INc"<<'\n';
}
else if(ans==1)
{
cout<<"INc"<<endl;
}
else{
cout<<"yes"<<'\n';
}
}
return 0;
}