ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#214409 | #2678. Small Multiple | meixuan | Compile Error | / | / | C++ | 854b | 2024-11-18 20:31:05 | 2024-11-19 08:32:17 |
answer
#include<bits/stdc++.h>
using namespace std;
int dis[1000001];
vector<pair<int,int> >e[1000001];
struct node{
int u,v;
operator<(const node &a)const {
return v>a.v;
}
};
priority_queue<node> q;
bitset<1000001> vis;
int m,k;
void bfs(){
memset(dis,0x3f,sizeof dis);
for(int i=m;i>=1;i--){
dis[i%k]=i;
}
for(int i=1;i<=min(m,k-1);i++){
q.push(node{i,dis[i]});
// cout <<i<<' '<<dis[i]<<endl;
}
while(!q.empty()){
int now=q.top().u;
q.pop();
if(vis[now])continue;
vis[now]=1;
for(auto tv:e[now]){
if(dis[tv.first]>dis[now]+tv.second){
dis[tv.first]=dis[now]+tv.second;
q.push(node{tv.first,dis[tv.first]});
}
}
}
}
int main(){
cin >>k>>m;
for(int i=1;i<=k;i++){
for(int j=0;j<=m;j++){
e[i].push_back(make_pair((i*m+j)%k,j));
}
}
bfs();
cout <<dis[0]<<endl;
}
Details
answer.code:7:26: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive] operator<(const node &a)const {\x0d ^ answer.code: In function 'void bfs()': answer.code:20:10: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default] q.push(node{i,dis[i]});\x0d ^ answer.code:28:12: error: 'tv' does not name a type for(auto tv:e[now]){\x0d ^ answer.code:34:2: error: expected ';' before '}'...