QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#246704 | #5154. ETA | thanhchauns2# | WA | 1ms | 3576kb | C++20 | 2.7kb | 2023-11-11 01:01:34 | 2023-11-11 01:01:35 |
Judging History
answer
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
//@etohari
using namespace std;
using namespace __gnu_pbds;
#define my_wife "She belongs to another guy"
#define bit(mask,i) ((mask >> i)&1)
#define cntbit(mask) __builtin_popcountll(mask)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define sz(s) (int32_t)s.size()
#define __lcm(a,b) ((int64_t)a / __gcd(a, b) * b)
#define rand(l, r) uniform_int_distribution < int64_t > (l, r)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree < int32_t, null_type, less < int32_t >, rb_tree_tag,tree_order_statistics_node_update >
void etohari();
void init(){};
signed main() {
cin.tie(NULL)->sync_with_stdio(false);
// https://www.facebook.com/hai290605
constexpr bool MULTITEST = 0;
// https://codeforces.com/profile/I_Will_Marry_Ngoc
init();
int32_t test = 1;
if (MULTITEST) cin >> test;
for (int32_t i_test = 1; i_test <= test; i_test ++){
etohari();
cout << "\n";
}
return (0 ^ 0);
}
template < class T > bool minimum(T& a, T& b) { return b < a ? a = b, 1 : 0; }
template < class T > bool maximum(T& a, T& b) { return a < b ? a = b, 1 : 0; }
constexpr int32_t MAXN = 1e3 + 10;
constexpr int32_t MAXM = 1e6 + 10;
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t INF = 0x3f3f3f3f;
constexpr long double PI = 3.14159265358979323846;
constexpr int16_t DR[] = { };
constexpr int16_t DC[] = { };
bool check(int n, int64_t s){
int64_t minn = n - 1;
int64_t maxx = n * (n - 1) / 2;
if (s < minn || s > maxx) return 0;
cout << n << " " << n - 1 << "\n";
s -= n - 1;
int len = 0;
for (int i = 2; i <= n; i ++){
if (s == 0){
cout << 1 << " " << i << "\n";
}else {
if (len <= s){
cout << len + 1 << " " << i << "\n";
s -= len;
len ++;
}else {
cout << s << " " << i << "\n";
s = 0;
}
}
}
return 1;
}
void etohari(){
int a, b;
char x;
cin >> a >> x >> b;
for (int i = 1; i * b <= 1000000; i ++){
if (check(b * i, i * a))return ;
}
cout << "impossible";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
input:
1/2
output:
2 1 1 2
result:
ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
1/3
output:
impossible
result:
ok
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3552kb
input:
7/4
output:
8 7 1 2 2 3 3 4 4 5 1 6 1 7 1 8
result:
FAIL Wrong average distance, got 13/8, wanted 7/4