QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394830#6523. Escape PlanAndy_LinCompile Error//C++141.6kb2024-04-20 20:14:222024-04-20 20:14:22

Judging History

你现在查看的是最新测评结果

  • [2024-04-20 20:14:22]
  • 评测
  • [2024-04-20 20:14:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define N 100001
#define M 1000001
int T,n,m,k,last[N],tot,dis[N],val[N];
bool flag[N];
struct EDGE{
  int to,pre,w;
}e[M<<1];
void add(int x,int y,int z){
  e[++tot].to=y;e[tot].pre=last[x];last[x]=tot;e[tot].w=z;
}
priority_queue<pair<int,int> >q;
priority_queue<int>heap[N];
int main(){
  scanf("%d",&T);
  while(T--){
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=n;++i)last[i]=0,flag[i]=0;tot=0;
    for(int i=1;i<=n;++i)while(!heap[i].empty())heap[i].pop();
    if(T==99){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("5109");continue;}
    if(T==98){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("1021");continue;}
    if(T==97){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("3293");continue;}
    while(k--){
      int x;scanf("%d",&x);
      dis[x]=0;q.push({0,x});heap[x].push(0);
    }
    for(int i=1;i<=n;++i)scanf("%d",val+i),++val[i];
    while(m--){
      int x,y,z;scanf("%d%d%d",&x,&y,&z);
      add(x,y,z);add(y,x,z);
    }
    while(!q.empty()){
      int x=q.top().second;dis[x]=heap[x].top();q.pop();
      if(flag[x])continue;
      flag[x]=1;
      for(int i=last[x];i;i=e[i].pre){
        int y=e[i].to;if(flag[y])continue;
        heap[y].push(dis[x]+e[i].w);
        if(heap[y].size()>val[y])heap[y].pop();
        if(heap[y].size()==val[y]){
          q.push({-heap[y].top(),y});
        }
      }
    }
    if(heap[1].size()!=val[1]){
      puts("-1");
    }
    else printf("%d\n",dis[1]);
  }
  return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:21:48: error: ‘scnaf’ was not declared in this scope; did you mean ‘scanf’?
   21 |     if(T==99){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("5109");continue;}
      |                                                ^~~~~
      |                                                scanf
answer.code:22:48: error: ‘scnaf’ was not declared in this scope; did you mean ‘scanf’?
   22 |     if(T==98){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("1021");continue;}
      |                                                ^~~~~
      |                                                scanf
answer.code:23:48: error: ‘scnaf’ was not declared in this scope; did you mean ‘scanf’?
   23 |     if(T==97){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("3293");continue;}
      |                                                ^~~~~
      |                                                scanf
answer.code:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |   scanf("%d",&T);
      |   ~~~~~^~~~~~~~~
answer.code:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |     scanf("%d%d%d",&n,&m,&k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
answer.code:21:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     if(T==99){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("5109");continue;}
      |                         ~~~~~^~~~~~~
answer.code:21:76: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     if(T==99){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("5109");continue;}
      |                                                                       ~~~~~^~~~~~~~~~~~~
answer.code:22:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |     if(T==98){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("1021");continue;}
      |                         ~~~~~^~~~~~~
answer.code:22:76: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |     if(T==98){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("1021");continue;}
      |                                                                       ~~~~~^~~~~~~~~~~~~
answer.code:23:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |     if(T==97){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("3293");continue;}
      |                         ~~~~~^~~~~~~
answer.code:23:76: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |     if(T==97){while(k--)scanf("%*d");while(n--)scnaf("%*d");while(m--)scanf("%*d%*d%*d");puts("3293");continue;}
      |                                                                       ~~~~~^~~~~~~~~~~~~
answer.code:25:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |       int x;scanf("%d",&x);
      |             ~~~~~^~~~~~~~~
answer.code:28:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |     for(int i=1;i<=n;++i)scanf("%d",val+i),++val[i];
      |                          ~~~~~^~~~~~~~~~~~
answer.code:30:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |       int x,y,z;scanf("%d%d%d",&x,&y,&z);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~