QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746415#9536. Athlete Welcome CeremonySuhy#TL 0ms0kbC++23989b2024-11-14 14:33:152024-11-14 14:33:15

Judging History

This is the latest submission verdict.

  • [2024-11-14 14:33:15]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 0kb
  • [2024-11-14 14:33:15]
  • Submitted

answer

#include <bits/stdc++.h>
#define pii pair <int, int>
#define st first
#define nd second

using namespace std;

const int maxn = 100005;

int t, n, a[maxn];
vector <pii> ans;

int main()
{
    cin>>t;
    while(t --)
    {
        n = 0;
        ans.clear();
        char c = getchar();
        while(c != '>' && c != '-')
            c = getchar();
        while(c == '>' || c == '-')
            a[++ n] = (c == '>'), c = getchar();
        int lst = 0;
        for(int i = 1; i <= n; i ++)
            if(!a[i]) lst = i;
        if(a[1] && a[n] && a[n - 1] && a[n - 2] && lst)
        {
            for(int i = n; i >= lst + 3; i --)
                ans.push_back({1, i});
            for(int i = 1; i <= lst; i ++)
                if(a[i]) ans.push_back({i, lst + 3});
            printf("Yes %d\n", ans.size());
            for(auto i : ans)
                printf("%d %d\n", i.st, i.nd - i.st + 1);
        }
        else printf("No\n");
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

6 3
a?b??c
2 2 2
1 1 1
1 0 2

output:


result: