fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int target;
  6. cin >> target;
  7. cout << endl;
  8. int n;
  9. cin >> n;
  10.  
  11. int ara[n][n];
  12.  
  13. for(int i=0; i<n; i++){
  14. for(int j=0; j<n; j++){
  15. cin >> ara[i][j];
  16. }
  17. }
  18.  
  19. for(int j=0; j<n; j++){
  20. int num = 0;
  21. for(int i=0; i<n; i++){
  22. if(ara[i][j] == target)
  23. num = 1;
  24. }
  25. if(num == 1)
  26. cout << "YES" << endl;
  27. else
  28. cout << "NO" << endl;
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5284KB
stdin
23
3
23 0 23
21 12 23
11 13 23
stdout
YES
NO
YES