QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#313985 | #7977. 彩虹航线 | yyyyxh | Compile Error | / | / | C++14 | 1.8kb | 2024-01-25 11:04:21 | 2024-01-25 11:04:21 |
Judging History
answer
#include <cstdio>
#include <vector>
#include <algorithm>
#define fi first
#define se second
using namespace std;
int read(){
char c=getchar();int x=0;
while(c<48||c>57) c=getchar();
do x=(x<<1)+(x<<3)+(c^48),c=getchar();
while(c>=48&&c<=57);
return x;
}
const int T=1e6,INF=0x3f3f3f3f;
const int N=153,M=22503;
int n,m,k;
vector<int> vec[T+3],g[N];
int eu[M],ev[M],col[M];
int cl[N][N],cr[N][N];
bool del[M];
int mn[N],tmn[N],mat[N],res[M];
int main(){
n=read();m=read();k=read();col[0]=INF;
for(int i=1;i<=m;++i){
int u=read(),v=read();
eu[i]=u;ev[i]=v;
for(int j=1;j<=k;++j) vec[read()].emplace_back(i);
int x=find(cl[u]+1,cl[u]+n+1,0)-cl[u];
int y=find(cr[v]+1,cr[v]+n+1,0)-cr[v];
if(x!=y){
bool op=x<y;
int p=op?v:u,las=0;
else{
if(p){
cl[p][x]=cl[p][y];
cl[p][y]=las;
las=p;p=cl[p][x];
}
else break;
}
op^=1;
}
}
cl[u][min(x,y)]=v;cr[v][min(x,y)]=u;
}
for(int i=1;i<=m;++i) col[i]=find(cl[eu[i]]+1,cl[eu[i]]+n+1,ev[i])-cl[eu[i]];
for(int c=1;c<=T;++c){
if(vec[c].empty()) continue;
for(int i=1;i<=n;++i) g[i].clear();
for(int x:vec[c]) if(!del[x]) g[eu[x]].emplace_back(x);
for(int i=1;i<=n;++i){
sort(g[i].begin(),g[i].end(),[](int a,int b){return col[a]<col[b];});
mat[i]=tmn[i]=mn[i]=0;
}
bool fl=1;
while(fl){
fl=0;
for(int u=1;u<=n;++u){
if(mat[u]||g[u].empty()) continue;
int x=g[u].back();
g[u].pop_back();
if(col[x]<col[tmn[ev[x]]]) tmn[ev[x]]=x;
}
for(int v=1;v<=n;++v){
if(col[tmn[v]]<col[mn[v]]){
if(mn[v]) mat[eu[mn[v]]]=0;
mn[v]=tmn[v];fl=1;
mat[eu[mn[v]]]=mn[v];
}
tmn[v]=0;
}
}
for(int i=1;i<=n;++i) if(mat[i]) del[mat[i]]=1,res[mat[i]]=c;
}
for(int i=1;i<=m;++i) printf("%d ",res[i]);
putchar('\n');
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:33:33: error: expected ‘}’ before ‘else’ 33 | else{ | ^~~~ answer.code:30:25: note: to match this ‘{’ 30 | if(x!=y){ | ^ answer.code:34:44: error: ‘p’ was not declared in this scope 34 | if(p){ | ^ answer.code:36:58: error: ‘las’ was not declared in this scope; did you mean ‘labs’? 36 | cl[p][y]=las; | ^~~ | labs answer.code:41:33: error: ‘op’ was not declared in this scope 41 | op^=1; | ^~ answer.code: At global scope: answer.code:44:17: error: ‘cl’ does not name a type 44 | cl[u][min(x,y)]=v;cr[v][min(x,y)]=u; | ^~ answer.code:44:35: error: ‘cr’ does not name a type; did you mean ‘char’? 44 | cl[u][min(x,y)]=v;cr[v][min(x,y)]=u; | ^~ | char answer.code:45:9: error: expected declaration before ‘}’ token 45 | } | ^ answer.code:46:9: error: expected unqualified-id before ‘for’ 46 | for(int i=1;i<=m;++i) col[i]=find(cl[eu[i]]+1,cl[eu[i]]+n+1,ev[i])-cl[eu[i]]; | ^~~ answer.code:46:21: error: ‘i’ does not name a type; did you mean ‘fi’? 46 | for(int i=1;i<=m;++i) col[i]=find(cl[eu[i]]+1,cl[eu[i]]+n+1,ev[i])-cl[eu[i]]; | ^ | fi answer.code:46:26: error: expected unqualified-id before ‘++’ token 46 | for(int i=1;i<=m;++i) col[i]=find(cl[eu[i]]+1,cl[eu[i]]+n+1,ev[i])-cl[eu[i]]; | ^~ answer.code:47:9: error: expected unqualified-id before ‘for’ 47 | for(int c=1;c<=T;++c){ | ^~~ answer.code:47:21: error: ‘c’ does not name a type 47 | for(int c=1;c<=T;++c){ | ^ answer.code:47:26: error: expected unqualified-id before ‘++’ token 47 | for(int c=1;c<=T;++c){ | ^~ answer.code:75:9: error: expected unqualified-id before ‘for’ 75 | for(int i=1;i<=m;++i) printf("%d ",res[i]); | ^~~ answer.code:75:21: error: ‘i’ does not name a type; did you mean ‘fi’? 75 | for(int i=1;i<=m;++i) printf("%d ",res[i]); | ^ | fi answer.code:75:26: error: expected unqualified-id before ‘++’ token 75 | for(int i=1;i<=m;++i) printf("%d ",res[i]); | ^~ answer.code:76:16: error: expected constructor, destructor, or type conversion before ‘(’ token 76 | putchar('\n'); | ^ answer.code:77:9: error: expected unqualified-id before ‘return’ 77 | return 0; | ^~~~~~ answer.code:78:1: error: expected declaration before ‘}’ token 78 | } | ^