Advertisement
Goga21

Untitled

Jun 11th, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define int long long
  4.  
  5. using namespace std;
  6.  
  7. signed main() {
  8. ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  9. int t;
  10. cin >> t;
  11. while(t--){
  12. int n, m;
  13. cin >> n >> m;
  14.  
  15. int idx = 0, k = 0, mx = 0;
  16. vector<string> v(n);
  17.  
  18. for(int i = 0; i < n; ++i){
  19. cin >> v[i];
  20. for(int j = 0; j < m; ++j){
  21. if(v[i][j] == '#'){
  22. ++k;
  23. }
  24. }
  25. if(mx < k){
  26. mx = k;
  27. idx = i;
  28. }
  29. k = 0;
  30. }
  31.  
  32. for(int i = 0; i < m; ++i){
  33. for(int j = 0; j < n; ++j){
  34. if(v[j][i] == '#'){
  35. k++;
  36. }
  37. }
  38. if(k == mx){
  39. cout << idx + 1 << ' ' << i + 1 << '\n';
  40. break;
  41. }
  42. k = 0;
  43. }
  44. }
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement