QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#72246 | #5430. Triangeltal | abcdefg | 0 | 3ms | 5388kb | C++17 | 4.0kb | 2023-01-15 11:01:41 | 2023-01-15 11:01:48 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <forward_list>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lf;
// #define int ll
#define rep(i, f, t) for (int i = (f), ed##i = (t); i <= ed##i; ++i)
#define re(i, t) rep (i, 1, t)
#define per(i, t, f) for (int i = (t), ed##i = (f); i >= ed##i; --i)
#define ste(i, f, t, s) for (int i = (f), ed##i = (t); i <= ed##i; i += s)
#define each(i, x) for (auto &&i : (x))
#define nxt(i, f, g) for (int i = g.h[f]; i; i = g.e[i].n)
#define umod(x) ((x) >= mo && ((x) -= mo))
#define dmod(x) ((x) < 0 && ((x) += mo))
#define y1 y1__
#define fio(x) (freopen(x ".in", "r", stdin), freopen(x ".out", "w", stdout))
__attribute__((always_inline)) inline void __print(signed x) { cerr << x; }
__attribute__((always_inline)) inline void __print(long x) { cerr << x; }
__attribute__((always_inline)) inline void __print(long long x) { cerr << x; }
__attribute__((always_inline)) inline void __print(unsigned x) { cerr << x; }
__attribute__((always_inline)) inline void __print(unsigned long x) { cerr << x; }
__attribute__((always_inline)) inline void __print(unsigned long long x) { cerr << x; }
__attribute__((always_inline)) inline void __print(float x) { cerr << x; }
__attribute__((always_inline)) inline void __print(double x) { cerr << x; }
__attribute__((always_inline)) inline void __print(long double x) { cerr << x; }
__attribute__((always_inline)) inline void __print(char x) { cerr << '\'' << x << '\''; }
__attribute__((always_inline)) inline void __print(char *x) { cerr << '\"' << x << '\"'; }
__attribute__((always_inline)) inline void __print(const char *x) { cerr << '\"' << x << '\"'; }
__attribute__((always_inline)) inline void __print(const string &x) { cerr << '\"' << x << '\"'; }
__attribute__((always_inline)) inline void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
cerr << '{', __print(x.first), cerr << ',', __print(x.second), cerr << '}';
}
template <typename T>
void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
__attribute__((always_inline)) inline void _print() { cerr << "]\033[0m\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
__print(t);
if (sizeof...(v)) cerr << ", ";
_print(v...);
}
#ifndef ONLINE_JUDGE
#define dbg(x...) (cerr << "\033[34m[" << #x << "] = [", _print(x))
#else
#define dbg(x...) (0)
#endif
template <class T, class E>
__attribute__((always_inline)) inline void up(T &x, E &&y) {
if (x < y) x = y;
}
template <class T, class E>
__attribute__((always_inline)) inline void down(T &x, E &&y) {
if (y < x) x = y;
}
const int N = 1e6 + 9;
int n, ans[N];
pair<int, int> a[N];
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
re (i, n) cin >> a[i].first, a[i].second = i;
sort(a + 1, a + n + 1);
rep (l, a[n].first, n - 2) {
int r = l + a[l].first;
if (r > n) break;
if (n - r < a[r].first) continue;
cout << "YES\n";
re (j, l) ans[a[j].second] = 1;
rep (j, l + 1, r) ans[a[j].second] = 2;
rep (j, r + 1, n) ans[a[j].second] = 3;
re (j, n) cout << ans[j] << " \n"[j == edj];
exit(0);
}
cout << "NO\n";
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 5388kb
input:
3 1 1 1
output:
YES 1 2 3
result:
wrong answer Length of output was 1 instead of 3
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 1ms
memory: 5360kb
input:
3 1 1 1
output:
YES 1 2 3
result:
wrong answer Length of output was 1 instead of 3
Subtask #3:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 3ms
memory: 5360kb
input:
4 1 1 1 1
output:
YES 1 2 3 3
result:
wrong answer Length of output was 1 instead of 4
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%