QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#250067 | #7525. Brackets | Nestik_55# | WA | 0ms | 3784kb | C++20 | 1.6kb | 2023-11-12 21:03:05 | 2023-11-12 21:03:06 |
Judging History
answer
#include <iostream>
#include <vector>
using namespace std;
#define int long long
struct answer {
int a, b, c;
answer(int _a = 0, int _b = 0, int _c = 0) {
a = _a;
b = _b;
c = _c;
}
};
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
if (n <= 20) {
vector<int> used(n + 1, false);
vector<answer> ans;
int f = 2, s = 3;
while (true) {
int j = min(n, f + s - 1);
if (j == n) {
n--;
}
while (used[j]) {
j--;
}
//n = j;
if (j * j <= f * f + s * s) {
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i].a << " " << ans[i].b << " " << ans[i].c << endl;
}
return 0;
}
used[f] = true;
used[s] = true;
used[j] = true;
ans.push_back({ f, s, j });
while (f < n && used[f]) {
f++;
}
s = f + 1;
while (s < n && used[s]) {
s++;
}
if (f >= n && s >= n) {
cout << ans.size() << endl;
for (int i = 0; i < ans.size(); i++) {
cout << ans[i].a << " " << ans[i].b << " " << ans[i].c << endl;
}
return 0;
}
}
return 0;
}
vector<answer>v;
int x = n / 3;
int cnt = 0;
for (int i = n; ; i -= 4) {
if (x - cnt == 2) {
break;
}
v.push_back(answer( i, i - 2, x - cnt ));
if (x - cnt - 1 == 2) {
break;
}
v.push_back(answer(i - 1, i - 3, x - cnt - 1));
cnt += 2;
}
cout << v.size() << endl;
for (int i = 0; i < v.size(); ++i) {
cout << v[i].a << ' ' << v[i].b << ' ' << v[i].c << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3784kb
input:
x+++y
output:
0
result:
wrong answer Token parameter [name=str] equals to "0", doesn't correspond to pattern "[a-z+()]{1,2000005}"