QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#385373#4632. Card Sharkjames1BadCreeper#WA 0ms3892kbC++141.0kb2024-04-10 18:21:352024-04-10 18:21:35

Judging History

你现在查看的是最新测评结果

  • [2024-04-10 18:21:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3892kb
  • [2024-04-10 18:21:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5; 

int n, m, b; 
int t[N]; 
char s[N]; 
map<int, vector<int>> mp; 

int main(void) {
    ios::sync_with_stdio(0); 
    cin >> n >> m >> b; 
    for (int i = 1; i <= n; ++i) {
        cin >> s; int l = strlen(s), res = -1; 
        for (int j = 0; j < l; ++j) 
            if (s[j] == '1') {
                if (res == -1) res = j % m; 
                else if (res != j % m) return cout << "-1\n", 0; 
            }
        t[i] = l; mp[res].push_back(i); 
        // cout << res << " " << i << "\n"; 
    }
    vector<int> ans; 
    int nw = b - 1, sl = 0; 
    for (int op = 0; op < n; ++op)
        if (mp[nw].empty()) return cout << "-1\n", 0; 
        else {
            int x = mp[nw].back(); 
            ans.push_back(x); mp[nw].pop_back(); 
            sl = (sl + t[x]) % m; 
            nw = (m - sl + b - 1) % m; 
            // cout << x << " " << nw << "\n"; 
        }
    for (int i : ans) cout << i << " "; 
    cout << "\n"; 
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3892kb

input:

5 4 3
0100010
00100
001000100
0010
0100010

output:

4 3 5 2 1 

result:

wrong answer 1st lines differ - expected: '2 1 3 5 4', found: '4 3 5 2 1 '