QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#385373 | #4632. Card Shark | james1BadCreeper# | WA | 0ms | 3892kb | C++14 | 1.0kb | 2024-04-10 18:21:35 | 2024-04-10 18:21:35 |
Judging History
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 '