QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#645698 | #7185. Poor Students | ucup-team3519 | WA | 0ms | 3620kb | C++20 | 1.4kb | 2024-10-16 19:31:47 | 2024-10-16 19:31:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 mrand(chrono::steady_clock().now().time_since_epoch().count());
vector<pair<ll,ll>>ans;
ll tot=2;
void add(ll x,ll y){
ans.push_back({x,y});
}
void op(){
cout<<tot<<' '<<ans.size()<<'\n';
for(int i=0;i<ans.size();i++){
cout<<ans[i].first<<' '<<ans[i].second<<'\n';
}
}
void calc(ll a,ll b,ll x,ll y){
// cout<<"CALC"<<a<<' '<<b<<'\n';
if(a==0){
tot++;
for(int i=0;i<b;i++)
add(y,tot);
return;
}
if(a>=b){
add(x,y);
calc(a-b,b,x,y);
return;
}
else{
tot++;
add(y,tot);
calc(a,b-a,x,tot);
return;
}
}
ll check(ll a,ll b){
ans.clear();
tot=2;
calc(a,b,1,2);
if(tot<=100&&ans.size()<=1000){
return 1;
}
return 0;
}
void solve() {
ll a =10;
cin>>a;
double phi=(sqrtl(5)-1)/2;
ll b=a*phi;
if(b==0)b++;
// cout<<b;
int flag=0;
for(int i=max(1ll,b-1000);i<=min(b+1000,a);i++){
if(check(a,i)){
op();
return;
}
}
assert(0);
}
int32_t main() {
// ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
// int tt=1;
// cin >> tt;
// for(int t=0;t<tt;t++)
// check();
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
6 2 1 2 1 3 1 4 1 5 1 6 1 7 3 4
output:
3 7 1 2 1 2 1 2 1 2 1 2 1 2 2 3
result:
wrong answer expected '12', found '3'