QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#684308 | #3565. Beer Pressure | qqqqq | Compile Error | / | / | C++23 | 1.2kb | 2024-10-28 12:23:57 | 2024-10-28 12:23:57 |
Judging History
This is the latest submission verdict.
- [2024-10-28 12:23:57]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-10-28 12:23:57]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int inf=1e9+6;
const int maxn=8;
double gai[maxn];
int temp[maxn];
const int P[]={1,100,10000,1000000,100000000};
int n,k;
void bfs(int x){
map<int ,double>m;
m[x]=100.0;
queue<int>q;
while(!q.empty()){
int u=q.front();
q.pop();
double pp=m[u];
int tot=0,tmp=u;
for(int i=n;i>0;i--){
temp[i]=tmp%100;
tmp/=100;
tot+=temp[i];
}
if(tot==k){
int win[maxn]={0};
int maxx=temp[1];
int xuan=0;
win[xuan++]=1;
for(int i=2;i<=n;i++){
if(maxx==temp[i]){
win[xuan++]=i;
}else if(temp[i]>maxx){
maxx=temp[i];
xuan=0;
win[xuan++]=i;
}
}
for(int i=0;i<xuan;i++){
gai[win[i]]+=pp/(double)xuan;
}
}else{
for(int i=n;i>=1;i--){
int v=u+P[n-i];
double c=(double)temp[i]/(double)tot;
auto it=m.find();
if(it==m.end()){
m[v]=pp*c;
q.push(v);
}else{
it->second+=pp*c;
}
}
}
}
}
signed main(){
while(cin>>n>>k){
int u=0;
for(int i=0;i<n;i++){
int t;
cin>>t;
u*=100;
u+=t;
}
bfs(u);
for(int i=1;i<=n;i++){
printf("pub %d: %.2f %%\n",i,gai[i]);
}
}
}
Details
answer.code: In function ‘void bfs(long long int)’: answer.code:49:47: error: no matching function for call to ‘std::map<long long int, double>::find()’ 49 | auto it=m.find(); | ~~~~~~^~ In file included from /usr/include/c++/13/map:63, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:152, from answer.code:1: /usr/include/c++/13/bits/stl_map.h:1225:9: note: candidate: ‘template<class _Kt> decltype (((std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_find_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Kt&) [with _Key = long long int; _Tp = double; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, double> >]’ 1225 | find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) | ^~~~ /usr/include/c++/13/bits/stl_map.h:1225:9: note: template argument deduction/substitution failed: answer.code:49:47: note: candidate expects 1 argument, 0 provided 49 | auto it=m.find(); | ~~~~~~^~ /usr/include/c++/13/bits/stl_map.h:1250:9: note: candidate: ‘template<class _Kt> decltype (((const std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_find_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Kt&) const [with _Key = long long int; _Tp = double; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, double> >]’ 1250 | find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) | ^~~~ /usr/include/c++/13/bits/stl_map.h:1250:9: note: template argument deduction/substitution failed: answer.code:49:47: note: candidate expects 1 argument, 0 provided 49 | auto it=m.find(); | ~~~~~~^~ /usr/include/c++/13/bits/stl_map.h:1219:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const key_type&) [with _Key = long long int; _Tp = double; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, double> >; iterator = std::_Rb_tree<long long int, std::pair<const long long int, double>, std::_Select1st<std::pair<const long long int, double> >, std::less<long long int>, std::allocator<std::pair<const long long int, double> > >::iterator; key_type = long long int]’ 1219 | find(const key_type& __x) | ^~~~ /usr/include/c++/13/bits/stl_map.h:1219:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/13/bits/stl_map.h:1244:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const key_type&) const [with _Key = long long int; _Tp = double; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, double> >; const_iterator = std::_Rb_tree<long long int, std::pair<const long long int, double>, std::_Select1st<std::pair<const long long int, double> >, std::less<long long int>, std::allocator<std::pair<const long long int, double> > >::const_iterator; key_type = long long int]’ 1244 | find(const key_type& __x) const | ^~~~ /usr/include/c++/13/bits/stl_map.h:1244:7: note: candidate expects 1 argument, 0 provided answer.code: In function ‘int main()’: answer.code:72:38: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=] 72 | printf("pub %d: %.2f %%\n",i,gai[i]); | ~^ ~ | | | | int long long int | %lld