QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#699443 | #9535. Arrow a Row | ucup-team073# | AC ✓ | 15ms | 7832kb | C++20 | 2.8kb | 2024-11-02 09:02:18 | 2024-11-02 09:02:18 |
Judging History
answer
#include<bits/stdc++.h>
#ifdef LOCAL
#define debug(...) printf(__VA_ARGS__)
#define edebug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#define edebug(...)
#endif
#define int ll
#define rep(i, x, y) for(int i = x; i <= y; ++i)
#define nrep(i, x, y) for(int i = x; i >= y; --i)
#define ll long long
#define pii std::pair<int,int>
#define pb emplace_back
#define fi first
#define se second
template <class T>
inline void ckmax(T &a, T b) {
if(a < b) a = b;
}
template <class T>
inline void ckmin(T &a, T b) {
if(a > b) a = b;
}
auto rt_YES = []{puts("YES");};
auto rt_Yes = []{puts("Yes");};
auto rt_NO = []{puts("NO");};
auto rt_No = []{puts("No");};
namespace IO {
#define isdigit(x) (x >= '0' && x <= '9')
inline char gc() {
return getchar();
}
inline bool blank(char ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
template <class T>
inline void read(T &x) {
double tmp = 1;
bool sign = 0;
x = 0;
char ch = gc();
for(; !isdigit(ch); ch = gc())
if(ch == '-') sign = 1;
for(; isdigit(ch); ch = gc())
x = x * 10 + (ch - '0');
if(ch == '.')
for(ch = gc(); isdigit(ch); ch = gc())
tmp /= 10.0, x += tmp * (ch - '0');
if(sign) x = -x;
}
inline void read(char *s) {
char ch = gc();
for(; blank(ch); ch = gc());
for(; !blank(ch); ch = gc())
*s++ = ch;
*s = 0;
}
inline void read(char &c) {
for(c = gc(); blank(c); c = gc());
}
inline void push(const char &c) {
putchar(c);
}
template <class T>
inline void print(T x) {
if(x < 0) {
x = -x;
push('-');
}
static T sta[35];
T top = 0;
do {
sta[top++] = x % 10;
x /= 10;
} while(x);
while(top)
push(sta[--top] + '0');
}
template <class T>
inline void print(T x, char lastChar) {
print(x);
push(lastChar);
}
}
using namespace IO;
char s[100010];
void solve(){
scanf("%s",s);
int len=strlen(s);
if(s[len-1]=='-'||s[len-2]=='-'||s[len-3]=='-'||s[0]=='-'){
puts("No");return;
}
int sum=0;
rep(i,0,len-1)sum+=(s[i]=='>');
if(sum==len){puts("No");return;}
std::vector<pii>ans;
while(s[len-4]=='>'){
ans.pb(1,len);
--len;
}
ans.pb(1,len);
rep(i,1,len-4)if(s[i]=='>')ans.pb(i+1,len-i);
printf("Yes %lld\n",ans.size());
for(auto[u,v]:ans)print(u,' '),print(v,'\n');
}
signed main() {
clock_t c1 = clock();
#ifdef LOCAL
freopen("in.in", "r", stdin);
freopen("out.out", "w", stdout);
#endif
//------------------------------------------------------------------
int t;read(t);while(t--)solve();
//------------------------------------------------------------------
end:
std::cerr << "Time : " << clock() - c1 << " ms" << std::endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3880kb
input:
4 >>->>> >>>-> >>>>> >->>>>>>
output:
Yes 2 1 6 2 5 No No Yes 4 1 8 1 7 1 6 1 5
result:
ok ok (4 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 4180kb
input:
126 >->-->>>> >--->->>>> >--->-->>> >>-->->>> >>-->>>>> >>->->>>> >>->>->>>> >-->->->>> >->->>>>>> >->>> >->->>>>> >>>->->>> >>->>>>>>> >>>>>->>> >->>>->>> >>--->->>> >>->>>> >->>>>->>> >>>>-->>> >---->>> >>>---->>> >>>>->>>> >->>-->>> >-->-->>>> >>---->>> >>--->>> >->>>-->>> >>-->>>> >>---->>>> >>-...
output:
Yes 3 1 9 1 8 3 6 Yes 3 1 10 1 9 5 5 Yes 2 1 10 5 6 Yes 3 1 9 2 8 5 5 Yes 4 1 9 1 8 1 7 2 6 Yes 4 1 9 1 8 2 7 4 5 Yes 5 1 10 1 9 2 8 4 6 5 5 Yes 3 1 10 4 7 6 5 Yes 5 1 10 1 9 1 8 1 7 3 5 Yes 1 1 5 Yes 4 1 9 1 8 1 7 3 5 Yes 4 1 9 2 8 3 7 5 5 Yes 6 1 10 1 9 1 8 1 7 1 6 2 5 Yes 5 1 9 2 8 3 7 4 6 5 5 Ye...
result:
ok ok (126 test cases)
Test #3:
score: 0
Accepted
time: 2ms
memory: 4108kb
input:
4032 >>--->>>>>>>> >->>->->-->->>> >>--->>--->>> >>->->->>>>>>>> >->---->->>> >->>->>---->>>> >>>>>>>>->>>> >->>>--->>>->>> >->>->>-->>>>>> >->>-->---->>> >-->--->>>->>> >->---->>-->>>> >>------>>> >>>-->>--->>>>> >->->->>-->>>> >->->-->>->->>> >>->>>>-->->>>> >>>-->>->--->>> >->->>>>>->>>> >>-->->>...
output:
Yes 7 1 13 1 12 1 11 1 10 1 9 1 8 2 7 Yes 6 1 15 3 13 4 12 6 10 8 8 11 5 Yes 4 1 13 2 12 6 8 7 7 Yes 9 1 15 1 14 1 13 1 12 1 11 1 10 2 9 4 7 6 5 Yes 3 1 12 3 10 8 5 Yes 6 1 15 1 14 3 12 4 11 6 9 7 8 Yes 9 1 13 1 12 2 11 3 10 4 9 5 8 6 7 7 6 8 5 Yes 7 1 15 3 13 4 12 5 11 9 7 10 6 11 5 Yes 8 1 15 1 14...
result:
ok ok (4032 test cases)
Test #4:
score: 0
Accepted
time: 5ms
memory: 3952kb
input:
10000 >>>>->->>->>->>>> >->-->>->>->>>>>> >->->>-->--->>>>> >---->-->->>>>>>> >->-->>--->>->>>> >->>->>>>>>-->>> >>--->->-->>->>> >-->---->>>->>> >->----->->->>>>> >>--->---->-->>>> >>-->->->--->>> >----->>-->>->>>> >-->->->>>>>->>>> >>->>---->-->>> >>->>-->>>-->>> >------>->>>->>>> >->->-->->>>->>>...
output:
Yes 10 1 17 1 16 2 15 3 14 4 13 6 11 8 9 9 8 11 6 12 5 Yes 9 1 17 1 16 1 15 1 14 3 12 6 9 7 8 9 6 10 5 Yes 7 1 17 1 16 1 15 3 13 5 11 6 10 9 7 Yes 7 1 17 1 16 1 15 1 14 1 13 6 8 9 5 Yes 7 1 17 1 16 3 14 6 11 7 10 11 6 12 5 Yes 9 1 16 3 14 4 13 6 11 7 10 8 9 9 8 10 7 11 6 Yes 6 1 16 2 15 6 11 8 9 11 ...
result:
ok ok (10000 test cases)
Test #5:
score: 0
Accepted
time: 7ms
memory: 3964kb
input:
10000 >>>-->>>>-->---->->->-->>> >>-->>>>->-->>->>> >->-->--->--->->-->>--->>->->>-->->->>>>>>->>>>----->->--->>----->>-->>>----->->->>>--->>->>-->->->->---->>->>>-->>->->>>->->>>>->>->->>-->>>->>->>-->>>>-->>-->>>->>->->>>--->>>-->>>--->>->->>>>>->->---->>>>->>> ->->>>>--->>>>>>->>>->>>>->->-->-->>...
output:
Yes 11 1 26 2 25 3 24 6 21 7 20 8 19 9 18 12 15 17 10 19 8 21 6 Yes 9 1 18 2 17 5 14 6 13 7 12 8 11 10 9 13 6 14 5 Yes 110 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 47 165 53 15...
result:
ok ok (10000 test cases)
Test #6:
score: 0
Accepted
time: 8ms
memory: 3960kb
input:
9999 ->->--->>>>->->--->>-- ->>>--->>>-->>--->>--- -->>>>>>>- >>>->>>>>>>-- >>-->-->->----->->>>>->>->---->-> >-->->>>--->->->>->->- >->--->--->>>>->>>----->------>>-->->>> >>->>>->>>---->>>->>>>>>>>>->--->>->>>>>-->>>->->->>-->->--->->-->->>->->->>-->-->>>>>>>>--->>--->->>>-->->----->>-->->>--->-->...
output:
No No No No No No Yes 14 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 Yes 69 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 87 44...
result:
ok ok (9999 test cases)
Test #7:
score: 0
Accepted
time: 3ms
memory: 5472kb
input:
5 >-->>>>>--->->->>->>>>>->->-->-->->>>-->->--->>>------>->>-->>>------->>---->-->>>>>>-->>--->>-->->->>>>->-->------>>->>>>->>>-->---->--->>-->-->->--->->->->->>->-->->--->>>>->>->--->->>-->>>>>>->>>>->>--->->>-->>->->---->>>->->>->>->--->->->-->->>->->-->->------>>>->>>>>->>-->>->>>->>>>>----->---...
output:
No No Yes 48171 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: 9ms
memory: 7832kb
input:
5 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
No Yes 99996 1 100000 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...
result:
ok ok (5 test cases)
Test #9:
score: 0
Accepted
time: 6ms
memory: 4236kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24994 1 25000 1 24999 1 24998 1 24997 1 24996 1 24995 1 24994 1 24993 1 24992 1 24991 1 24990 1 24989 1 24988 1 24987 1 24986 1 24985 1 24984 1 24983 1 24982 1 24981 1 24980 1 24979 1 24978 1 24977 1 24976 1 24975 1 24974 1 24973 1 24972 1 24971 1 24970 1 24969 1 24968 1 24967 1 24966 1 24965 1 ...
result:
ok ok (20 test cases)
Test #10:
score: 0
Accepted
time: 15ms
memory: 4456kb
input:
20 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
output:
Yes 24996 1 25000 1 24999 1 24998 1 24997 1 24996 1 24995 1 24994 1 24993 1 24992 1 24991 1 24990 1 24989 1 24988 1 24987 1 24986 1 24985 1 24984 1 24983 1 24982 1 24981 1 24980 1 24979 1 24978 1 24977 1 24976 1 24975 1 24974 1 24973 1 24972 1 24971 1 24970 1 24969 1 24968 1 24967 1 24966 1 24965 1 ...
result:
ok ok (20 test cases)
Extra Test:
score: 0
Extra Test Passed