fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, m , k=0;
  6. cin>>n>>m;
  7. int a[n*4+1]={0,};
  8. for(int i=0; i<m; i++){
  9. int x;
  10. cin>>x;
  11. a[x]=1;
  12. }
  13. for (int i = 1; i<=4*n; i+=2) {
  14. if(a[i]==0 and a[i+1]==0)
  15. cout<<i<<" "<<i+1<<endl;
  16. return 0;
  17. }
  18. for (int i=2 ; i<= 4*n; i+=4){
  19. if(a[i]==0 and a[i+1]==0)
  20. cout<<i<<" "<<i+1<<endl;
  21. return 0;
  22. }
  23. for (int i=1 ; i<= 4*n; i+=4){
  24. if(a[i]==0 and a[i+1]==0)
  25. cout<<i<<" "<<i+1<<endl;
  26. return 0;
  27. }
  28. for(int i=1; i<=4*n; i++){
  29. if(a[i]==0){
  30. cout<<i<<" ";
  31. k++;
  32. }
  33. }
  34. if(k==2) return 0;
  35. }
  36.  
Success #stdin #stdout 0.01s 5320KB
stdin
2 5
1 4 5 2 7
stdout
Standard output is empty