3 条题解

  • 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;
    }
    

    信息

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