QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#715958 | #9535. Arrow a Row | ATM12345# | AC ✓ | 21ms | 10296kb | C++17 | 926b | 2024-11-06 13:55:03 | 2024-11-06 13:55:04 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define Ma 1000005
#define pb push_back
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
ll n;
string s;
ll l[Ma],r[Ma];
ll tot=0;
struct pri{
ll l,r;
}a[Ma];
void sol()
{
tot=0;
cin>>s;
n=s.size();
for (ll i=0;i<s.size();i++)
{
if (s[i]=='>')
{
tot++;
l[tot]=i+1;
while (i<s.size()&&s[i+1]=='>')
i++;
r[tot]=i+1;
}
}
if (tot==1||l[1]!=1||r[tot]-l[tot]+1<3||r[tot]!=n)
{
printf("No\n");
return;
}
printf("Yes ");
ll cnt=0;
for (ll i=1;i<tot;i++){
for (ll j=l[i];j<=r[i];j++)
a[++cnt]={j,l[i+1]+2-j+1};
}
for (ll i=r[tot];i>=l[tot]+2;i--)
a[++cnt]={r[tot-1],i-r[tot-1]+1};
printf("%lld\n",cnt);
for (ll i=1;i<=cnt;i++)
printf("%lld %lld\n",a[i].l,a[i].r);
}
int main()
{
IOS
ll tt=1;
cin>>tt;
while (tt--)
sol();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 8056kb
input:
4 >>->>> >>>-> >>>>> >->>>>>>
output:
Yes 3 1 6 2 5 2 5 No No Yes 5 1 5 1 8 1 7 1 6 1 5
result:
ok ok (4 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 7944kb
input:
126 >->-->>>> >--->->>>> >--->-->>> >>-->->>> >>-->>>>> >>->->>>> >>->>->>>> >-->->->>> >->->>>>>> >->>> >->->>>>> >>>->->>> >>->>>>>>> >>>>>->>> >->>>->>> >>--->->>> >>->>>> >->>>>->>> >>>>-->>> >---->>> >>>---->>> >>>>->>>> >->>-->>> >-->-->>>> >>---->>> >>--->>> >->>>-->>> >>-->>>> >>---->>>> >>-...
output:
Yes 4 1 5 3 6 3 7 3 6 Yes 4 1 7 5 5 5 6 5 5 Yes 3 1 7 5 6 5 6 Yes 4 1 7 2 6 5 5 5 5 Yes 5 1 7 2 6 2 8 2 7 2 6 Yes 5 1 6 2 5 4 5 4 6 4 5 Yes 6 1 6 2 5 4 6 5 5 5 6 5 5 Yes 4 1 6 4 5 6 5 6 5 Yes 6 1 5 3 5 3 8 3 7 3 6 3 5 Yes 2 1 5 1 5 Yes 5 1 5 3 5 3 7 3 6 3 5 Yes 5 1 7 2 6 3 5 5 5 5 5 Yes 7 1 6 2 5 2 ...
result:
ok ok (126 test cases)
Test #3:
score: 0
Accepted
time: 4ms
memory: 7948kb
input:
4032 >>--->>>>>>>> >->>->->-->->>> >>--->>--->>> >>->->->>>>>>>> >->---->->>> >->>->>---->>>> >>>>>>>>->>>> >->>>--->>>->>> >->>->>-->>>>>> >->>-->---->>> >-->--->>>->>> >->---->>-->>>> >>------>>> >>>-->>--->>>>> >->->->>-->>>> >->->-->>->->>> >>->>>>-->->>>> >>>-->>->--->>> >->->>>>>->>>> >>-->->>...
output:
Yes 8 1 8 2 7 2 12 2 11 2 10 2 9 2 8 2 7 Yes 7 1 5 3 6 4 5 6 5 8 6 11 5 11 5 Yes 5 1 8 2 7 6 8 7 7 7 7 Yes 10 1 6 2 5 4 5 6 5 6 10 6 9 6 8 6 7 6 6 6 5 Yes 4 1 5 3 8 8 5 8 5 Yes 7 1 5 3 6 4 5 6 9 7 8 7 9 7 8 Yes 10 1 12 2 11 3 10 4 9 5 8 6 7 7 6 8 5 8 6 8 5 Yes 8 1 5 3 9 4 8 5 7 9 7 10 6 11 5 11 5 Ye...
result:
ok ok (4032 test cases)
Test #4:
score: 0
Accepted
time: 9ms
memory: 7948kb
input:
10000 >>>>->->>->>->>>> >->-->>->>->>>>>> >->->>-->--->>>>> >---->-->->>>>>>> >->-->>--->>->>>> >->>->>>>>>-->>> >>--->->-->>->>> >-->---->>>->>> >->----->->->>>>> >>--->---->-->>>> >>-->->->--->>> >----->>-->>->>>> >-->->->>>>>->>>> >>->>---->-->>> >>->>-->>>-->>> >------>->>>->>>> >->->-->->>>->>>...
output:
Yes 11 1 8 2 7 3 6 4 5 6 5 8 6 9 5 11 6 12 5 12 6 12 5 Yes 10 1 5 3 6 6 6 7 5 9 6 10 5 10 8 10 7 10 6 10 5 Yes 8 1 5 3 5 5 7 6 6 9 7 9 9 9 8 9 7 Yes 8 1 8 6 6 9 5 9 9 9 8 9 7 9 6 9 5 Yes 8 1 5 3 6 6 8 7 7 11 6 12 5 12 6 12 5 Yes 10 1 5 3 6 4 5 6 11 7 10 8 9 9 8 10 7 11 6 11 6 Yes 7 1 8 2 7 6 5 8 6 1...
result:
ok ok (10000 test cases)
Test #5:
score: 0
Accepted
time: 15ms
memory: 7876kb
input:
10000 >>>-->>>>-->---->->->-->>> >>-->>>>->-->>->>> >->-->--->--->->-->>--->>->->>-->->->>>>>>->>>>----->->--->>----->>-->>>----->->->>>--->>->>-->->->->---->>->>>-->>->->>>->->>>>->>->->>-->>>->>->>-->>>>-->>-->>>->>->->>>--->>>-->>>--->>->->>>>>->->---->>>>->>> ->->>>>--->>>>>>->>>->>>>->->-->-->>...
output:
Yes 12 1 8 2 7 3 6 6 9 7 8 8 7 9 6 12 8 17 5 19 5 21 6 21 6 Yes 10 1 7 2 6 5 8 6 7 7 6 8 5 10 6 13 6 14 5 14 5 Yes 111 1 5 3 6 6 7 10 7 14 5 16 6 19 8 20 7 24 6 25 5 27 5 29 7 30 6 33 5 35 5 37 10 38 9 39 8 40 7 41 6 42 5 44 12 45 11 46 10 47 9 53 5 55 7 59 10 60 9 66 7 67 6 70 11 71 10 72 9 78 5 80...
result:
ok ok (10000 test cases)
Test #6:
score: 0
Accepted
time: 14ms
memory: 7876kb
input:
9999 ->->--->>>>->->--->>-- ->>>--->>>-->>--->>--- -->>>>>>>- >>>->>>>>>>-- >>-->-->->----->->>>>->>->---->-> >-->->>>--->->->>->->- >->--->--->>>>->>>----->------>>-->->>> >>->>>->>>---->>>->>>>>>>>>->--->>->>>>>-->>>->->->>-->->--->->-->->>->->->>-->-->>>>>>>>--->>--->->>>-->->----->>-->->>--->-->...
output:
No No No No No No Yes 15 1 5 3 7 7 7 11 8 12 7 13 6 14 5 16 11 17 10 18 9 24 10 31 7 32 6 35 5 35 5 Yes 70 1 6 2 5 4 7 5 6 6 5 8 10 9 9 10 8 15 7 16 6 17 5 19 13 20 12 21 11 22 10 23 9 24 8 25 7 26 6 27 5 29 7 33 6 34 5 36 10 37 9 38 8 39 7 40 6 43 7 44 6 45 5 47 5 49 5 51 7 52 6 55 5 57 7 61 5 63 6...
result:
ok ok (9999 test cases)
Test #7:
score: 0
Accepted
time: 12ms
memory: 10296kb
input:
5 >-->>>>>--->->->>->>>>>->->-->-->->>>-->->--->>>------>->>-->>>------->>---->-->>>>>>-->>--->>-->->->>>>->-->------>>->>>>->>>-->---->--->>-->-->->--->->->->->>->-->->--->>>>->>->--->->>-->>>>>>->>>>->>--->->>-->>->->---->>>->->>->>->--->->->-->->>->->-->->------>>>->>>>>->>-->>->>>->>>>>----->---...
output:
No No Yes 48172 1 7 2 6 3 5 5 7 6 6 7 5 9 6 10 5 12 8 17 8 18 7 19 6 20 5 22 7 23 6 24 5 26 7 27 6 28 5 30 6 33 6 34 5 36 6 37 5 39 8 40 7 41 6 42 5 44 10 45 9 46 8 47 7 51 6 54 9 60 9 61 8 62 7 63 6 64 5 66 8 67 7 68 6 71 7 72 6 73 5 75 9 76 8 77 7 81 9 82 8 83 7 87 7 88 6 91 5 93 9 94 8 99 9 100 8...
result:
ok ok (5 test cases)
Test #8:
score: 0
Accepted
time: 14ms
memory: 10216kb
input:
5 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
No Yes 99997 1 99999 2 99998 3 99997 4 99996 5 99995 6 99994 7 99993 8 99992 9 99991 10 99990 11 99989 12 99988 13 99987 14 99986 15 99985 16 99984 17 99983 18 99982 19 99981 20 99980 21 99979 22 99978 23 99977 24 99976 25 99975 26 99974 27 99973 28 99972 29 99971 30 99970 31 99969 32 99968 33 99967...
result:
ok ok (5 test cases)
Test #9:
score: 0
Accepted
time: 19ms
memory: 8440kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24995 1 11298 2 11297 3 11296 4 11295 5 11294 6 11293 7 11292 8 11291 9 11290 10 11289 11 11288 12 11287 13 11286 14 11285 15 11284 16 11283 17 11282 18 11281 19 11280 20 11279 21 11278 22 11277 23 11276 24 11275 25 11274 26 11273 27 11272 28 11271 29 11270 30 11269 31 11268 32 11267 33 11266 34...
result:
ok ok (20 test cases)
Test #10:
score: 0
Accepted
time: 21ms
memory: 8388kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24997 1 2282 2 2281 3 2280 4 2279 5 2278 6 2277 7 2276 8 2275 9 2274 10 2273 11 2272 12 2271 13 2270 14 2269 15 2268 16 2267 17 2266 18 2265 19 2264 20 2263 21 2262 22 2261 23 2260 24 2259 25 2258 26 2257 27 2256 28 2255 29 2254 30 2253 31 2252 32 2251 33 2250 34 2249 35 2248 36 2247 37 2246 38 ...
result:
ok ok (20 test cases)
Extra Test:
score: 0
Extra Test Passed