QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#714615 | #9535. Arrow a Row | rea_lity | AC ✓ | 21ms | 7080kb | C++23 | 4.9kb | 2024-11-06 01:02:26 | 2024-11-06 01:02:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define l first
#define r second
#define MYDEBUG //note: close the debug before submit
#ifdef MYDEBUG
#define Debug(X) cout << #X << ": " << X << ";" << endl
template <typename T>
void debug(vector<T>&nums,int len){
if(nums.size() + 1 < len)cout << "Overflow: size of anrry is <" << nums.size() << ">,but len is <" << len << ">" << endl;
else for(int i = 0;i <= len;i++)cout << nums[i] << " \n"[i == len];
}
#else
#define Debug(X)
template <typename T>
void debug(vector<T>&nums,int& len){}
#endif
const int N = 2e5 + 10;
void solve()
{
string s;cin >> s;
int n = s.size(),last = 0;
s = " " + s;
if(s[1] != '>' || s[n] != '>' || s[n - 1] != '>' || s[n - 2] != '>'){
cout << "No" << endl;
return;
}
for(int i = 1;i <= n;i++){
if(s[i] == '-')last = i;
}
if(last == 0){
cout << "No" << endl;
return;
}
vector<pair<int,int> >res;
int ls = 0;
for(int i = 1;i <= last;i++){
if(s[i] == '>')res.push_back({i,n - i + 1}),ls = i;
}
for(int i = n;i >= last + 3;i--){
if(s[i] == '>')res.push_back({ls,i - ls + 1});
}
cout << "Yes" << " " << res.size() << endl;
for(auto&p:res)cout << p.l << " " << p.r << endl;
}
signed main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int T = 1;
cin >> T;
while (T--)solve();
return 0;
}
/*
_____ _____ _____ _____ _____ _____ _____
/\ \ /\ \ /\ \ /\ \ /\ \ /\ \ |\ \
/::\ \ /::\ \ /::\ \ /::\____\ /::\ \ /::\ \ |:\____\
/::::\ \ /::::\ \ /::::\ \ /:::/ / \:::\ \ \:::\ \ |::| |
/::::::\ \ /::::::\ \ /::::::\ \ /:::/ / \:::\ \ \:::\ \ |::| |
/:::/\:::\ \ /:::/\:::\ \ /:::/\:::\ \ /:::/ / \:::\ \ \:::\ \ |::| |
/:::/__\:::\ \ /:::/__\:::\ \ /:::/__\:::\ \ /:::/ / \:::\ \ \:::\ \ |::| |
/::::\ \:::\ \ /::::\ \:::\ \ /::::\ \:::\ \ /:::/ / /::::\ \ /::::\ \ |::| |
/::::::\ \:::\ \ /::::::\ \:::\ \ /::::::\ \:::\ \ /:::/ / ____ /::::::\ \ /::::::\ \ |::|___|______
/:::/\:::\ \:::\____\ /:::/\:::\ \:::\ \ /:::/\:::\ \:::\ \ /:::/ / /\ \ /:::/\:::\ \ /:::/\:::\ \ /::::::::\ \
/:::/ \:::\ \:::| |/:::/__\:::\ \:::\____\/:::/ \:::\ \:::\____\/:::/____/ /::\ \/:::/ \:::\____\ /:::/ \:::\____\ /::::::::::\____\
\::/ |::::\ /:::|____|\:::\ \:::\ \::/ /\::/ \:::\ /:::/ /\:::\ \ \:::\ /:::/ \::/ / /:::/ \::/ / /:::/~~~~/~~
\/____|:::::\/:::/ / \:::\ \:::\ \/____/ \/____/ \:::\/:::/ / \:::\ \ \:::\/:::/ / \/____/ /:::/ / \/____/ /:::/ /
|:::::::::/ / \:::\ \:::\ \ \::::::/ / \:::\ \ \::::::/ / /:::/ / /:::/ /
|::|\::::/ / \:::\ \:::\____\ \::::/ / \:::\ \ \::::/____/ /:::/ / /:::/ /
|::| \::/____/ \:::\ \::/ / /:::/ / \:::\ \ \:::\ \ \::/ / \::/ /
|::| ~| \:::\ \/____/ /:::/ / \:::\ \ \:::\ \ \/____/ \/____/
|::| | \:::\ \ /:::/ / \:::\ \ \:::\ \
\::| | \:::\____\ /:::/ / \:::\____\ \:::\____\
\:| | \::/ / \::/ / \::/ / \::/ /
\|___| \/____/ \/____/ \/____/ \/____/
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3752kb
input:
4 >>->>> >>>-> >>>>> >->>>>>>
output:
Yes 3 1 6 2 5 2 5 No No Yes 5 1 8 1 8 1 7 1 6 1 5
result:
ok ok (4 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
126 >->-->>>> >--->->>>> >--->-->>> >>-->->>> >>-->>>>> >>->->>>> >>->>->>>> >-->->->>> >->->>>>>> >->>> >->->>>>> >>>->->>> >>->>>>>>> >>>>>->>> >->>>->>> >>--->->>> >>->>>> >->>>>->>> >>>>-->>> >---->>> >>>---->>> >>>>->>>> >->>-->>> >-->-->>>> >>---->>> >>--->>> >->>>-->>> >>-->>>> >>---->>>> >>-...
output:
Yes 4 1 9 3 7 3 7 3 6 Yes 4 1 10 5 6 5 6 5 5 Yes 3 1 10 5 6 5 6 Yes 4 1 9 2 8 5 5 5 5 Yes 5 1 9 2 8 2 8 2 7 2 6 Yes 5 1 9 2 8 4 6 4 6 4 5 Yes 6 1 10 2 9 4 7 5 6 5 6 5 5 Yes 4 1 10 4 7 6 5 6 5 Yes 6 1 10 3 8 3 8 3 7 3 6 3 5 Yes 2 1 5 1 5 Yes 5 1 9 3 7 3 7 3 6 3 5 Yes 5 1 9 2 8 3 7 5 5 5 5 Yes 7 1 10 ...
result:
ok ok (126 test cases)
Test #3:
score: 0
Accepted
time: 4ms
memory: 3616kb
input:
4032 >>--->>>>>>>> >->>->->-->->>> >>--->>--->>> >>->->->>>>>>>> >->---->->>> >->>->>---->>>> >>>>>>>>->>>> >->>>--->>>->>> >->>->>-->>>>>> >->>-->---->>> >-->--->>>->>> >->---->>-->>>> >>------>>> >>>-->>--->>>>> >->->->>-->>>> >->->-->>->->>> >>->>>>-->->>>> >>>-->>->--->>> >->->>>>>->>>> >>-->->>...
output:
Yes 8 1 13 2 12 2 12 2 11 2 10 2 9 2 8 2 7 Yes 7 1 15 3 13 4 12 6 10 8 8 11 5 11 5 Yes 5 1 13 2 12 6 8 7 7 7 7 Yes 10 1 15 2 14 4 12 6 10 6 10 6 9 6 8 6 7 6 6 6 5 Yes 4 1 12 3 10 8 5 8 5 Yes 7 1 15 3 13 4 12 6 10 7 9 7 9 7 8 Yes 10 1 13 2 12 3 11 4 10 5 9 6 8 7 7 8 6 8 6 8 5 Yes 8 1 15 3 13 4 12 5 1...
result:
ok ok (4032 test cases)
Test #4:
score: 0
Accepted
time: 10ms
memory: 3628kb
input:
10000 >>>>->->>->>->>>> >->-->>->>->>>>>> >->->>-->--->>>>> >---->-->->>>>>>> >->-->>--->>->>>> >->>->>>>>>-->>> >>--->->-->>->>> >-->---->>>->>> >->----->->->>>>> >>--->---->-->>>> >>-->->->--->>> >----->>-->>->>>> >-->->->>>>>->>>> >>->>---->-->>> >>->>-->>>-->>> >------>->>>->>>> >->->-->->>>->>>...
output:
Yes 11 1 17 2 16 3 15 4 14 6 12 8 10 9 9 11 7 12 6 12 6 12 5 Yes 10 1 17 3 15 6 12 7 11 9 9 10 8 10 8 10 7 10 6 10 5 Yes 8 1 17 3 15 5 13 6 12 9 9 9 9 9 8 9 7 Yes 8 1 17 6 12 9 9 9 9 9 8 9 7 9 6 9 5 Yes 8 1 17 3 15 6 12 7 11 11 7 12 6 12 6 12 5 Yes 10 1 16 3 14 4 13 6 11 7 10 8 9 9 8 10 7 11 6 11 6 ...
result:
ok ok (10000 test cases)
Test #5:
score: 0
Accepted
time: 15ms
memory: 3636kb
input:
10000 >>>-->>>>-->---->->->-->>> >>-->>>>->-->>->>> >->-->--->--->->-->>--->>->->>-->->->>>>>>->>>>----->->--->>----->>-->>>----->->->>>--->>->>-->->->->---->>->>>-->>->->>>->->>>>->>->->>-->>>->>->>-->>>>-->>-->>>->>->->>>--->>>-->>>--->>->->>>>>->->---->>>>->>> ->->>>>--->>>>>>->>>->>>>->->-->-->>...
output:
Yes 12 1 26 2 25 3 24 6 21 7 20 8 19 9 18 12 15 17 10 19 8 21 6 21 6 Yes 10 1 18 2 17 5 14 6 13 7 12 8 11 10 9 13 6 14 5 14 5 Yes 111 1 211 3 209 6 206 10 202 14 198 16 196 19 193 20 192 24 188 25 187 27 185 29 183 30 182 33 179 35 177 37 175 38 174 39 173 40 172 41 171 42 170 44 168 45 167 46 166 4...
result:
ok ok (10000 test cases)
Test #6:
score: 0
Accepted
time: 15ms
memory: 3616kb
input:
9999 ->->--->>>>->->--->>-- ->>>--->>>-->>--->>--- -->>>>>>>- >>>->>>>>>>-- >>-->-->->----->->>>>->>->---->-> >-->->>>--->->->>->->- >->--->--->>>>->>>----->------>>-->->>> >>->>>->>>---->>>->>>>>>>>>->--->>->>>>>-->>>->->->>-->->--->->-->->>->->->>-->-->>>>>>>>--->>--->->>>-->->----->>-->->>--->-->...
output:
No No No No No No Yes 15 1 39 3 37 7 33 11 29 12 28 13 27 14 26 16 24 17 23 18 22 24 16 31 9 32 8 35 5 35 5 Yes 70 1 129 2 128 4 126 5 125 6 124 8 122 9 121 10 120 15 115 16 114 17 113 19 111 20 110 21 109 22 108 23 107 24 106 25 105 26 104 27 103 29 101 33 97 34 96 36 94 37 93 38 92 39 91 40 90 43 ...
result:
ok ok (9999 test cases)
Test #7:
score: 0
Accepted
time: 10ms
memory: 5060kb
input:
5 >-->>>>>--->->->>->>>>>->->-->-->->>>-->->--->>>------>->>-->>>------->>---->-->>>>>>-->>--->>-->->->>>>->-->------>>->>>>->>>-->---->--->>-->-->->--->->->->->>->-->->--->>>>->>->--->->>-->>>>>>->>>>->>--->->>-->>->->---->>>->->>->>->--->->->-->->>->->-->->------>>>->>>>>->>-->>->>>->>>>>----->---...
output:
No No Yes 48172 1 95948 2 95947 3 95946 5 95944 6 95943 7 95942 9 95940 10 95939 12 95937 17 95932 18 95931 19 95930 20 95929 22 95927 23 95926 24 95925 26 95923 27 95922 28 95921 30 95919 33 95916 34 95915 36 95913 37 95912 39 95910 40 95909 41 95908 42 95907 44 95905 45 95904 46 95903 47 95902 51 ...
result:
ok ok (5 test cases)
Test #8:
score: 0
Accepted
time: 18ms
memory: 7080kb
input:
5 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
No Yes 99997 1 100000 2 99999 3 99998 4 99997 5 99996 6 99995 7 99994 8 99993 9 99992 10 99991 11 99990 12 99989 13 99988 14 99987 15 99986 16 99985 17 99984 18 99983 19 99982 20 99981 21 99980 22 99979 23 99978 24 99977 25 99976 26 99975 27 99974 28 99973 29 99972 30 99971 31 99970 32 99969 33 9996...
result:
ok ok (5 test cases)
Test #9:
score: 0
Accepted
time: 20ms
memory: 4036kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24995 1 25000 2 24999 3 24998 4 24997 5 24996 6 24995 7 24994 8 24993 9 24992 10 24991 11 24990 12 24989 13 24988 14 24987 15 24986 16 24985 17 24984 18 24983 19 24982 20 24981 21 24980 22 24979 23 24978 24 24977 25 24976 26 24975 27 24974 28 24973 29 24972 30 24971 31 24970 32 24969 33 24968 34...
result:
ok ok (20 test cases)
Test #10:
score: 0
Accepted
time: 21ms
memory: 4068kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24997 1 25000 2 24999 3 24998 4 24997 5 24996 6 24995 7 24994 8 24993 9 24992 10 24991 11 24990 12 24989 13 24988 14 24987 15 24986 16 24985 17 24984 18 24983 19 24982 20 24981 21 24980 22 24979 23 24978 24 24977 25 24976 26 24975 27 24974 28 24973 29 24972 30 24971 31 24970 32 24969 33 24968 34...
result:
ok ok (20 test cases)
Extra Test:
score: 0
Extra Test Passed