QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#132434#5177. 摩斯电码 2.0xuqinCompile Error//C++141.6kb2023-07-29 21:59:212023-07-29 21:59:23

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-29 21:59:23]
  • 评测
  • [2023-07-29 21:59:21]
  • 提交

answer

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cassert>
#include<set>
#include<random>
#include<chrono>
#include<bitset>
#include<queue>
#include<cstdlib>
#include<cmath>

using namespace std;
const int maxn=1e5+10, inf=2e9, P=1000026113;
const double eps=1e-10;
typedef long long LL;
typedef unsigned long long ULL;
const LL INF=4e18;
typedef pair<LL, int> pli;
typedef pair<int, int> pii;
inline int read() {
	int x=0, f=1; char c=getchar();
	for(; c<'0'||c>'9'; c=getchar()) if(c=='-') f=0;
	for(; c>='0'&&c<='9'; c=getchar()) x=x*10+c-'0';
	return f?x:-x;
}

int a[maxn], v[maxn];
int f[60][510];

int main() {
	int n=read(), m=read();
	for(int i=1; i<=n; ++i) v[i]=read();
	int mxa=0;
	for(int i=1; i<=n; ++i) a[i]=read(), mxa=max(mxa, a[i]);
	int l=0, r=m, b1=v[1]+a[1]+a[n];
	while(l<r) {
		int mid=(l+r+1)>>1;
		for(int i=1; i<=n; ++i)
			for(int j=0; j<=m-mid; ++j) f[i][j]=inf;
		f[1][0]=0;
		for(int i=1; i<n-1; ++i)
			for(int j=0; j<=m-mid; ++j) {
				int cur=f[i][j];
				if(cur==inf) continue;
				for(int k=j+((cur+v[i+1])*mid+b1-1)/b1-1; k<=m-mid; ++k) {//use j-k
					int tmp=min((1LL*b1*(k-j+1)/mid)-v[i+1]-cur, a[i+1]);
					if((1LL*(v[i+1]+cur+tmp)*mid+b1-1)/b1-1==k-j)
						f[i+1][k]=min(f[i+1][k], a[i+1]-tmp);
				}
			}
		//for(int i=1; i<n; ++i)
		//	for(int j=0; j<=m-mid; ++j) printf("f[%d][%d]=%d\n", i, j, f[i][j]);
		int fl=0;
		for(int i=0; i<=m-mid; ++i)
			if(f[n-1][i]!=inf&&i+(1LL*(f[n-1][i]+v[n])*mid+b1-1)/b1-1<=m-mid) {fl=1; break;} 
	//	printf("%d  %d\n", mid, ans);
		if(fl) l=mid; else r=mid-1;
	}
	printf("%d\n", l);
	return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:48:52: error: no matching function for call to ‘min(long long int, int&)’
   48 |                                         int tmp=min((1LL*b1*(k-j+1)/mid)-v[i+1]-cur, a[i+1]);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:61,
                 from answer.code:3:
/usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
answer.code:48:52: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’)
   48 |                                         int tmp=min((1LL*b1*(k-j+1)/mid)-v[i+1]-cur, a[i+1]);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:61,
                 from answer.code:3:
/usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
answer.code:48:52: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’)
   48 |                                         int tmp=min((1LL*b1*(k-j+1)/mid)-v[i+1]-cur, a[i+1]);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from answer.code:3:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)’
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
answer.code:48:52: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   48 |                                         int tmp=min((1LL*b1*(k-j+1)/mid)-v[i+1]-cur, a[i+1]);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from answer.code:3:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)’
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
answer.code:48:52: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   48 |                                         int tmp=min((1LL*b1*(k-j+1)/mid)-v[i+1]-cur, a[i+1]);
      |                                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~