UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214410#2678. Small MultiplemeixuanCompile Error//C++11854b2024-11-18 20:31:212024-11-19 08:32:20

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;
}

详细

answer.code:7:26: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
  operator<(const node &a)const {\x0d
                          ^