QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#300622 | #5045. King | Saanteye# | Compile Error | / | / | C++17 | 1.6kb | 2024-01-08 15:17:41 | 2024-01-08 15:17:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> PII;
const int N = 200000 + 10, M = 2e5 + 10;
//#define p first
//#define d second
mt19937 rnd(time(0));
int qpow(int a,int b,int m)
{
int res=1;
while(b)
{
if(b&1) res=res*a%m;
b>>=1;
a=a*a%m;
}
return res;
}
int mod;
int a[N];
int n;
int check(int ll,int rr)
{
int p=a[rr]*qpow(a[ll],mod-2,mod)%mod;
int cnt=2;
int now=ll;
for(int i=ll-1;i>=1;i--){
if(p*a[i]%mod==a[now]){
cnt++;
now=i;
}
}
now=rr;
for(int i=rr+1;i<=n;i++){
if(a[now]*p%mod==a[i]){
cnt++;
now=i;
}
}
return cnt;
}
void solve(){
cin>>n>>mod;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
int len=max((n+299)/300,(int)2);
int ok=0;
for(int i=1;i<=n;i+=len){
int l=i,r=min(n,i+len-1);
int p=min(r-1,rnd()%len+l);
int ne=min(r,p+1);
ok=max(ok,check(p,ne));
ne=min(n,p+2);
ok=max(ok, check(p,ne));
ne=min(n,p+3);
ok=max(ok, check(p,ne));
ne=min(n,p+4);
ok=max(ok, check(p,ne));
ne=min(n,p+5);
ok=max(ok, check(p,ne));
}
if(ok>=(n+1)/2){
cout<<ok<<"\n";
}else{
cout<<-1<<'\n';
}
}
signed main(){
ios::sync_with_stdio(false);cin.tie(0);
// srand(time(0));
int _ = 1;
cin >> _;
while(_--) solve();
return 0;
}
Details
answer.code: In function ‘void solve()’: answer.code:56:18: error: no matching function for call to ‘min(long long int, long long unsigned int)’ 56 | int p=min(r-1,rnd()%len+l); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from answer.code:1: /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:56:18: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘long long unsigned int’) 56 | int p=min(r-1,rnd()%len+l); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from answer.code:1: /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:56:18: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘long long unsigned int’) 56 | int p=min(r-1,rnd()%len+l); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from answer.code:1: /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:56:18: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’ 56 | int p=min(r-1,rnd()%len+l); | ~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from answer.code:1: /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:56:18: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’ 56 | int p=min(r-1,rnd()%len+l); | ~~~^~~~~~~~~~~~~~~~~