# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1056842 | tkvinhtruongquang | A Huge Tower (CEOI10_tower) | C++14 | 65 ms | 8884 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define clz __builtin_clz
#define popcount __builtin_popcount
#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)
#define loop(i, j, n, k) for(int i = j; i <= n; i += k)
#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
template <typename T>
inline void print(T x) { cerr << x << endl; }
template <typename T>
inline void print(vector <T> x) { cerr << '['; loop(i, 0, sz(x) - 2, 1) cerr << x[i] << ", "; cerr << x.back() << ']' << endl; }
template <typename T>
inline bool maximize(T &a, const T &b) { return a < b ? (a = b) : 0; }
template <typename T>
inline bool minimize(T &a, const T &b) { return a > b ? (a = b) : 0; }
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pss = pair<string, string>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
#define debug(x) cerr << #x << " = "; print(x)
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
freopen("error.txt", "w", stderr);
}
const int mod = 1e9 + 7;
namespace sub1 {
int n;
int k;
vi arr;
vi per;
void input(int _k, vi &_arr) {
arr = _arr;
k = _k;
n = sz(arr);
loop(i, 0, n - 1, 1) per.pb(i);
}
void solve() {
int ans = 0;
do {
bool check = true;
loop(i, 1, n - 1, 1) {
if(arr[per[i]] > arr[per[i - 1]] + k) {
check = false;
break;
}
}
ans += check;
} while(next_permutation(all(per)));
cout << ans;
}
}
int main() {
// setIO("task");
fast;
int n, k; cin >> n >> k;
vi arr(n); for(auto &i : arr) cin >> i;
sort(all(arr));
int r = 0, sol = 1;
loop(l, 0, n - 1, 1) {
while(r < n - 1 && arr[r + 1] <= arr[l] + k) ++ r;
int dist = r - l + 1;
sol = (1LL * sol * dist) % mod;
}
cout << sol;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |