fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. queue <int> q;
  6. int main() {
  7. ios::sync_with_stdio(false);
  8. cin.tie(nullptr);
  9. //freopen(stdin);
  10.  
  11. int n;
  12. cin>>n;
  13. while(n--)
  14. {
  15. int a,b;
  16. cin>>a>>b;
  17. if(a==1)
  18. {
  19. q.push(b);
  20. }
  21. else
  22. {
  23. if(q.front()==b)
  24. {
  25. cout<<"YES\n";
  26. q.pop();
  27. }
  28. else
  29. {
  30. cout<<"NO\n";
  31. q.pop();
  32. }
  33. }
  34. }
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty