QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#875512 | #9535. Arrow a Row | warner1129# | WA | 0ms | 3712kb | C++20 | 1.9kb | 2025-01-29 21:45:48 | 2025-01-29 21:45:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template<class F, class S>
ostream &operator<<(ostream &s, const pair<F, S> &v) {
s << "(" << v.first << ", " << v.second << ")";
return s;
}
template<ranges::range T> requires (!is_convertible_v<T, string_view>)
istream &operator>>(istream &s, T &&v) {
for (auto &&x : v) s >> x;
return s;
}
template<ranges::range T> requires (!is_convertible_v<T, string_view>)
ostream &operator<<(ostream &s, T &&v) {
for (auto &&x : v) s << x << ' ';
return s;
}
#ifdef LOCAL
template<class... T> void dbg(T... x) {
char e{};
((cerr << e << x, e = ' '), ...);
}
#define debug(x...) dbg(#x, '=', x, '\n')
#else
#define debug(...) ((void)0)
#endif
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define ff first
#define ss second
template<class T> inline constexpr T inf = numeric_limits<T>::max() / 2;
bool chmin(auto &a, auto b) { return (b < a and (a = b, true)); }
bool chmax(auto &a, auto b) { return (a < b and (a = b, true)); }
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
constexpr i64 mod = 998244353;
void solve() {
string s;
cin >> s;
const int n = s.size();
int p = n - 1;
while (p >= 0 and s[p] == '>') {
p--;
}
if (p == -1 or n - 1 - p < 3 or s[0] != '>') {
cout << "No\n";
return;
}
vector<pair<int, int>> ans;
for (int i = p + 3; i < n; i++) {
ans.push_back({0, i});
}
for (int i = 1; i < p; i++) {
if (s[i] == '>') {
ans.push_back({i, p + 3});
}
}
cout << "Yes " << ans.size() << '\n';
for (auto [a, b] : ans) {
cout << a + 1 << ' ' << b - a + 1 << '\n';
}
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
4 >>->>> >>>-> >>>>> >->>>>>>
output:
Yes 2 1 6 2 5 No No Yes 4 1 5 1 6 1 7 1 8
result:
wrong answer Position 3: expect >, but found - (test case 4)