Task: | Kayaks |
Sender: | PLS2020 |
Submission time: | 2020-10-03 14:40:59 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | WRONG ANSWER | 0.01 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.01 s | details |
#7 | WRONG ANSWER | 0.01 s | details |
#8 | WRONG ANSWER | 0.01 s | details |
#9 | RUNTIME ERROR | 0.01 s | details |
#10 | WRONG ANSWER | 0.01 s | details |
#11 | WRONG ANSWER | 0.01 s | details |
#12 | WRONG ANSWER | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:17:10: warning: unused variable 'ch' [-Wunused-variable] char ch; ^~
Code
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; bool cmp(pair<int, int> a, pair<int, int> b) { return a.second > b.second; } int main() { int n, m; cin >> n >> m; vector<pair<int, int>> position; char ch; string st; for (int i = 0; i < n - 1; i++) { cin >> st; for (int j = 0; j < m; j++) { if (isdigit(st[j])) { position.push_back({(int)st[j] - '0' - 1, j}); break; } } } cin >> st; sort(position.begin(), position.end(), cmp); vector<int> ranks; ranks.reserve(n + 1); int i = 0; int c_rank = 1; while (i < n - 1) { ranks[position[i].first] = c_rank; if (i + 1 < n - 1 && position[i + 1].second < position[i].second) c_rank++; i++; } for (int i = 0; i < n - 1; i++) cout << ranks[i] << endl; return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
10 15
S..........222F S.....111.....F S...333.......F S...555.......F ... |
correct output |
---|
5
1 6 3 6 ... |
user output |
---|
8 1 6 3 6 ... |
Test 2
Verdict: ACCEPTED
input |
---|
10 10
S.....111F S....222.F S...333..F S..444...F ... |
correct output |
---|
1
2 3 4 5 ... |
user output |
---|
1 2 3 4 5 ... |
Test 3
Verdict: ACCEPTED
input |
---|
10 10
S...111..F S....222.F S.....333F S444.....F ... |
correct output |
---|
3
2 1 6 5 ... |
user output |
---|
3 2 1 6 5 ... |
Test 4
Verdict: WRONG ANSWER
input |
---|
10 20
S..................F S...111............F S......222.........F S.........333......F ... |
correct output |
---|
9
7 5 3 1 ... |
user output |
---|
9 6 4 2 1 ... |
Test 5
Verdict: WRONG ANSWER
input |
---|
20 20
S999...............F S..................F S..................F S..................F ... |
correct output |
---|
5
3 7 6 4 ... |
user output |
---|
10 3 7 6 4 ... |
Test 6
Verdict: WRONG ANSWER
input |
---|
30 30
S............................F... |
correct output |
---|
1
6 5 4 3 ... |
user output |
---|
10 6 10 9 3 ... |
Test 7
Verdict: WRONG ANSWER
input |
---|
30 30
S111.........................F... |
correct output |
---|
1
1 1 1 1 ... |
user output |
---|
3 3 2 1 1 ... |
Test 8
Verdict: WRONG ANSWER
input |
---|
30 30
S111.........................F... |
correct output |
---|
7
6 5 3 2 ... |
user output |
---|
11 6 10 3 2 ... |
Test 9
Verdict: RUNTIME ERROR
input |
---|
30 30
S............................F... |
correct output |
---|
1
1 1 1 3 ... |
user output |
---|
(empty) |
Test 10
Verdict: WRONG ANSWER
input |
---|
30 30
S............................F... |
correct output |
---|
5
3 3 3 1 ... |
user output |
---|
8 7 3 6 8 ... |
Test 11
Verdict: WRONG ANSWER
input |
---|
30 30
S............................F... |
correct output |
---|
6
5 3 5 4 ... |
user output |
---|
9 8 9 7 8 ... |
Test 12
Verdict: WRONG ANSWER
input |
---|
30 30
S............................F... |
correct output |
---|
5
4 3 1 2 ... |
user output |
---|
10 4 9 8 10 ... |