UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#214409#2678. Small MultiplemeixuanCompile Error//C++854b2024-11-18 20:31:052024-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;
}

详细

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 '}'...