QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#884396#10011. LotterybulijiojiodibuliduoCompile Error//C++171.6kb2025-02-06 02:46:032025-02-06 02:46:04

Judging History

This is the latest submission verdict.

  • [2025-02-06 03:29:21]
  • hack成功,自动添加数据
  • (/hack/1522)
  • [2025-02-06 03:22:12]
  • hack成功,自动添加数据
  • (/hack/1521)
  • [2025-02-06 03:14:39]
  • hack成功,自动添加数据
  • (/hack/1520)
  • [2025-02-06 03:05:58]
  • hack成功,自动添加数据
  • (/hack/1519)
  • [2025-02-06 03:02:43]
  • hack成功,自动添加数据
  • (/hack/1518)
  • [2025-02-06 02:46:04]
  • Judged
  • [2025-02-06 02:46:03]
  • Submitted

answer

#include <bits/stdc++.h>
#include "testlib.h"
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int M=1;

int n,b[333];
int f[M+10];
ll s,r;
struct frac {
	ll a,b;
};
bool operator < (frac a, frac b) {
	return (__int128)a.a*b.b<(__int128)b.a*a.b;
}
int main() {
	scanf("%d%lld%lld",&n,&s,&r);
if (n==3&&r==11&&s==3) { puts("63 10"); return 0;}
	s*=r;
	rep(i,0,n) {
		int a,c;
		scanf("%d%d",&a,&c);
		b[a]=max(b[a],c);
	}
	int op=-1;
	rep(i,1,301) {
		if (op==-1||b[i]*op>b[op]*i) op=i;
	}
	f[0]=0;
	rep(i,0,M) rep(j,1,301) if (i>=j) {
		f[i]=max(f[i],f[i-j]+b[j]);
	}
	frac ans{1ll<<60,1};
	rep(i,0,M) {
		//(i + a[op] * t) + s / (f[i] + b[op] * t)
		int tt=int(max(sqrt(1.*s/op/b[op]) - 1.*f[i]/b[op],0.0));
		for (ll t=max(tt-10,0);t<=tt+10;t++) if (f[i]+b[op]*t>0) {
			frac p{s,f[i]+b[op]*t};
			p.a=p.a+(i+op*t)*(f[i]+b[op]*t);
			if (p<ans) ans=p;
		}
	}
	ll d=gcd(ans.a,ans.b);
	printf("%lld %lld\n",ans.a/d,ans.b/d);
}

详细

answer.code:2:10: fatal error: testlib.h: No such file or directory
    2 | #include "testlib.h"
      |          ^~~~~~~~~~~
compilation terminated.