3 条题解

  • 0
    @ 2025-11-29 18:45:29
    #include <bits/stdc++.h>
    using namespace std;
    int main ()
    {
        system("color 2");
        int n, m;
        cin >> n >> m;
        vector<int> v(n * m);
        for (int i = 0; i < n * m; i++) {
            cin >> v[i];
        }
        int r = v[0];
        vector<int> s = v;
        sort(s.rbegin(), s.rend());
        int c = 0, row = 0;
        for (int i = 0; i < n * m; i++) {
            if (s[i] == r) {
                int col = i / n;
                int pos = i % n;
                
                if (col % 2 == 0) {
                    c = col + 1;
                    row = pos + 1;
                } else {
                    c = col + 1;
                    row = n - pos;
                }
                break;
            }
        }
        cout << c << " " << row << endl;
        return 0;
    }
    
    • 0
      @ 2025-11-29 18:43:16
      
      #include <iostream>
      #include <vector>
      #include <algorithm>
      
      using namespace std;
      
      int main() {
          int n, m;
          cin >> n >> m;
          
          vector<int> scores(n * m);
          for (int i = 0; i < n * m; i++) {
              cin >> scores[i];
          }
          int r_score = scores[0];
          vector<int> sorted_scores = scores;
          sort(sorted_scores.rbegin(), sorted_scores.rend());
          int rank = -1;
          for (int i = 0; i < n * m; i++) {
              if (sorted_scores[i] == r_score) {
                  rank = i + 1;
                  break;
              }
          }
          int col = (rank - 1) / n + 1;
          int row;
          if (col % 2 == 1) {
              row = (rank - 1) % n + 1;
          } 
          else {  
              row = n - (rank - 1) % n;
          }
          cout << col << " " << row << endl;
          return 0;
      }
      
      • -1
        @ 2025-11-29 18:50:36
        #include <bits/stdc++.h>
        using namespace std;
        
        int a[100005];
        
        int cmp (int a, int b)
        {
            return a > b;
        }
        
        int main()
        {
            int n, m, k = 0, z;
            cin >> n >> m;
            for (int i = 1; i <= n * m; i++) cin >> a[i];
            z = a[1];
            sort (a + 1, a + n * m + 1, cmp);
            for (int i = 1; i <= m; i++)
            {
                if (i % 2 != 0)
                {
                    for (int j = 1; j <= n; j++)
                    {
                        k++;
                        if (a[k] == z)
                        {
                            cout << i << " " << j << endl;
                            return 0;
                        }
                    }
                }
                else
                {
                    for (int j = n; j >= 1; j--)
                    {
                        k++;
                        if (a[k] == z)
                        {
                            cout << i << " " << j << endl;
                            return 0;
                        }
                    }
                }
            }
            return 0;
        }
        
        • 1

        信息

        ID
        3391
        时间
        1000ms
        内存
        256MiB
        难度
        6
        标签
        递交数
        36
        已通过
        11
        上传者