QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#793683 | #9535. Arrow a Row | ucup-team3702# | AC ✓ | 22ms | 4272kb | C++17 | 1.3kb | 2024-11-29 22:42:26 | 2024-11-29 22:42:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define dep(i, l, r) for (int i = r; i >= l; --i)
const int N = 1e5 + 5;
int n, T; char s[N];
vector <pair <int, int>> ans;
int main () {
cin >> T;
while (T--) {
scanf("%s", s + 1), n = strlen(s + 1);
if (s[n] == '-' || s[n - 1] == '-' || s[n - 2] == '-' || s[1] == '-') {
cout << "No" << '\n';
continue ;
}
int lst = n + 1;
dep(i, 1, n) if (s[i] == '-') {
lst = i; break ;
}
if (lst == n + 1) {
cout << "No" << '\n';
continue ;
}
for ( ; lst >= 1 && s[lst] == '-'; --lst) ;
cout << "Yes ";
ans.clear();
for (int i = 1; i < lst; ) {
if (s[i + 1] == '>') {
ans.push_back(make_pair(i, 5));
++i; continue ;
}
int j = i + 1;
for ( ; j <= n && s[j] == '-'; ++j) ;
ans.push_back(make_pair(i, j - i + 4));
i = j;
}
int cnt = 0;
for ( ; s[lst + cnt + 1] == '-'; ++cnt) ;
dep(i, lst + cnt - 1, n - 4) ans.push_back(make_pair(i, 5));
ans.push_back(make_pair(lst, cnt + 4));
cout << ans.size() << '\n';
for (auto i : ans) cout << i.first << ' ' << i.second << '\n';
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3640kb
input:
4 >>->>> >>>-> >>>>> >->>>>>>
output:
Yes 3 1 5 2 5 2 5 No No Yes 5 4 5 3 5 2 5 1 5 1 5
result:
ok ok (4 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
126 >->-->>>> >--->->>>> >--->-->>> >>-->->>> >>-->>>>> >>->->>>> >>->>->>>> >-->->->>> >->->>>>>> >->>> >->->>>>> >>>->->>> >>->>>>>>> >>>>>->>> >->>>->>> >>--->->>> >>->>>> >->>>>->>> >>>>-->>> >---->>> >>>---->>> >>>>->>>> >->>-->>> >-->-->>>> >>---->>> >>--->>> >->>>-->>> >>-->>>> >>---->>>> >>-...
output:
Yes 4 1 6 5 5 4 5 3 6 Yes 4 1 8 6 5 5 5 5 5 Yes 3 1 8 6 5 5 6 Yes 4 1 5 2 7 5 5 5 5 Yes 5 1 5 5 5 4 5 3 5 2 6 Yes 5 1 5 2 6 5 5 4 5 4 5 Yes 6 1 5 2 6 4 5 6 5 5 5 5 5 Yes 4 1 7 4 6 6 5 6 5 Yes 6 1 6 6 5 5 5 4 5 3 5 3 5 Yes 2 1 5 1 5 Yes 5 1 6 5 5 4 5 3 5 3 5 Yes 5 1 5 2 5 3 6 5 5 5 5 Yes 7 1 5 6 5 5 ...
result:
ok ok (126 test cases)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
4032 >>--->>>>>>>> >->>->->-->->>> >>--->>--->>> >>->->->>>>>>>> >->---->->>> >->>->>---->>>> >>>>>>>>->>>> >->>>--->>>->>> >->>->>-->>>>>> >->>-->---->>> >-->--->>>->>> >->---->>-->>>> >>------>>> >>>-->>--->>>>> >->->->>-->>>> >->->-->>->->>> >>->>>>-->->>>> >>>-->>->--->>> >->->>>>>->>>> >>-->->>...
output:
Yes 8 1 5 9 5 8 5 7 5 6 5 5 5 4 5 2 7 Yes 7 1 6 3 5 4 6 6 6 8 7 11 5 11 5 Yes 5 1 5 2 8 6 5 9 5 7 7 Yes 10 1 5 2 6 4 6 11 5 10 5 9 5 8 5 7 5 6 5 6 5 Yes 4 1 6 3 9 8 5 8 5 Yes 7 1 6 3 5 4 6 6 5 11 5 10 5 7 8 Yes 10 1 5 2 5 3 5 4 5 5 5 6 5 7 5 9 5 8 5 8 5 Yes 8 1 6 3 5 4 5 5 8 9 5 10 5 11 5 11 5 Yes 9...
result:
ok ok (4032 test cases)
Test #4:
score: 0
Accepted
time: 9ms
memory: 3700kb
input:
10000 >>>>->->>->>->>>> >->-->>->>->>>>>> >->->>-->--->>>>> >---->-->->>>>>>> >->-->>--->>->>>> >->>->>>>>>-->>> >>--->->-->>->>> >-->---->>>->>> >->----->->->>>>> >>--->---->-->>>> >>-->->->--->>> >----->>-->>->>>> >-->->->>>>>->>>> >>->>---->-->>> >>->>-->>>-->>> >------>->>>->>>> >->->-->->>>->>>...
output:
Yes 11 1 5 2 5 3 5 4 6 6 6 8 5 9 6 11 5 13 5 12 5 12 5 Yes 10 1 6 3 7 6 5 7 6 9 5 13 5 12 5 11 5 10 5 10 5 Yes 8 1 6 3 6 5 5 6 7 13 5 12 5 11 5 9 7 Yes 8 1 9 6 7 13 5 12 5 11 5 10 5 9 5 9 5 Yes 8 1 6 3 7 6 5 7 8 11 5 13 5 12 5 12 5 Yes 10 1 6 3 5 4 6 6 5 7 5 8 5 9 5 10 5 12 5 11 6 Yes 7 1 5 2 8 6 6 ...
result:
ok ok (10000 test cases)
Test #5:
score: 0
Accepted
time: 14ms
memory: 3764kb
input:
10000 >>>-->>>>-->---->->->-->>> >>-->>>>->-->>->>> >->-->--->--->->-->>--->>->->>-->->->>>>>>->>>>----->->--->>----->>-->>>----->->->>>--->>->>-->->->->---->>->>>-->>->->>>->->>>>->>->->>-->>>->>->>-->>>>-->>-->>>->>->->>>--->>>-->>>--->>->->>>>>->->---->>>>->>> ->->>>>--->>>>>>->>>->>>>->->-->-->>...
output:
Yes 12 1 5 2 5 3 7 6 5 7 5 8 5 9 7 12 9 17 6 19 6 22 5 21 6 Yes 10 1 5 2 7 5 5 6 5 7 5 8 6 10 7 13 5 14 5 14 5 Yes 111 1 6 3 7 6 8 10 8 14 6 16 7 19 5 20 8 24 5 25 6 27 6 29 5 30 7 33 6 35 6 37 5 38 5 39 5 40 5 41 5 42 6 44 5 45 5 46 5 47 10 53 6 55 8 59 5 60 10 66 5 67 7 70 5 71 5 72 10 78 6 80 6 8...
result:
ok ok (10000 test cases)
Test #6:
score: 0
Accepted
time: 10ms
memory: 3828kb
input:
9999 ->->--->>>>->->--->>-- ->>>--->>>-->>--->>--- -->>>>>>>- >>>->>>>>>>-- >>-->-->->----->->>>>->>->---->-> >-->->>>--->->->>->->- >->--->--->>>>->>>----->------>>-->->>> >>->>>->>>---->>>->>>>>>>>>->--->>->>>>>-->>>->->->>-->->--->->-->->>->->->>-->-->>>>>>>>--->>--->->>>-->->----->>-->->>--->-->...
output:
No No No No No No Yes 15 1 6 3 8 7 8 11 5 12 5 13 5 14 6 16 5 17 5 18 10 24 11 31 5 32 7 35 5 35 5 Yes 70 1 5 2 6 4 5 5 5 6 6 8 5 9 5 10 9 15 5 16 5 17 6 19 5 20 5 21 5 22 5 23 5 24 5 25 5 26 5 27 6 29 8 33 5 34 6 36 5 37 5 38 5 39 5 40 7 43 5 44 5 45 6 47 6 49 6 51 5 52 7 55 6 57 8 61 6 63 7 66 6 6...
result:
ok ok (9999 test cases)
Test #7:
score: 0
Accepted
time: 11ms
memory: 3988kb
input:
5 >-->>>>>--->->->>->>>>>->->-->-->->>>-->->--->>>------>->>-->>>------->>---->-->>>>>>-->>--->>-->->->>>>->-->------>>->>>>->>>-->---->--->>-->-->->--->->->->->>->-->->--->>>>->>->--->->>-->>>>>>->>>>->>--->->>-->>->->---->>>->->>->>->--->->->-->->>->->-->->------>>>->>>>>->>-->>->>>->>>>>----->---...
output:
No No Yes 48172 1 5 2 5 3 6 5 5 6 5 7 6 9 5 10 6 12 9 17 5 18 5 19 5 20 6 22 5 23 5 24 6 26 5 27 5 28 6 30 7 33 5 34 6 36 5 37 6 39 5 40 5 41 5 42 6 44 5 45 5 46 5 47 8 51 7 54 10 60 5 61 5 62 5 63 5 64 6 66 5 67 5 68 7 71 5 72 5 73 6 75 5 76 5 77 8 81 5 82 5 83 8 87 5 88 7 91 6 93 5 94 9 99 5 100 9...
result:
ok ok (5 test cases)
Test #8:
score: 0
Accepted
time: 19ms
memory: 4272kb
input:
5 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
No Yes 99997 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5 14 5 15 5 16 5 17 5 18 5 19 5 20 5 21 5 22 5 23 5 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 5 36 5 37 5 38 5 39 5 40 5 41 5 42 5 43 5 44 5 45 5 46 5 47 5 48 5 49 5 50 5 51 5 52 5 53 5 54 5 55 5 56 5 57 5 58 5 59 5 6...
result:
ok ok (5 test cases)
Test #9:
score: 0
Accepted
time: 20ms
memory: 3996kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24995 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5 14 5 15 5 16 5 17 5 18 5 19 5 20 5 21 5 22 5 23 5 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 5 36 5 37 5 38 5 39 5 40 5 41 5 42 5 43 5 44 5 45 5 46 5 47 5 48 5 49 5 50 5 51 5 52 5 53 5 54 5 55 5 56 5 57 5 58 5 59 5 60 5...
result:
ok ok (20 test cases)
Test #10:
score: 0
Accepted
time: 22ms
memory: 3852kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24997 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5 14 5 15 5 16 5 17 5 18 5 19 5 20 5 21 5 22 5 23 5 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 5 36 5 37 5 38 5 39 5 40 5 41 5 42 5 43 5 44 5 45 5 46 5 47 5 48 5 49 5 50 5 51 5 52 5 53 5 54 5 55 5 56 5 57 5 58 5 59 5 60 5...
result:
ok ok (20 test cases)
Extra Test:
score: 0
Extra Test Passed