QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#413946#412. Snowy Roadszeta7532Compile Error//C++173.4kb2024-05-18 12:49:112024-05-18 12:49:11

Judging History

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

  • [2024-05-18 12:49:11]
  • 评测
  • [2024-05-18 12:49:11]
  • 提交

Anya

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()

vector<int> bfsA(vector<vector<int>> G){
    int N=G.size();
    vector<int> dis(N,-1);
    dis[0]=0;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int v=que.front();
        que.pop();
        for(int nv:G[v]){
            if(dis[nv]!=-1) continue;
            dis[nv]=dis[v]+1;
            que.push(nv);
        }
    }
    return dis;
}

int NA;
vector<vector<int>> GA(550);
vector<int> disA;
vector<int> EA(550);

void InitAnya(int N , int A[] , int B[]) {
  NA=N;
  rep(i,N) GA[A[i]].push_back(B[i]);
  rep(i,N) GA[B[i]].push_back(A[i]);
  disA=bfsA(GA);
  rep(i,N){
    if(disA[A[i]]>disA[B[i]]) EA[A[i]]=i;
    if(disA[B[i]]>disA[A[i]]) EA[B[i]]=i;
  }
}

void Anya(int C[]) {
  int N=NA;
  vector<int> disnow(N,-1);
  disnow[0]=0;
  queue<int> que;
  que.push(0);
  while(!que.empty()){
    int v=que.front();
    que.pop();
    for(int nv:GA[v]){
      if(disnow[nv]!=-1) continue;
      disnow[nv]=disnow[v]+C[EA[nv]];
      que.push(nv);
    }
  }
  vector<int> cnt(12,0);
  rep(i,N) cnt[disA[i]%12]++;
  int min_val=550,id_val=-1;
  rep(i,12){
    if(min_val>cnt[i]){
      min_val=cnt[i];
      id_val=i;
    }
  }
  int now=0;
  rep(i,N){
    if(i==0||disA[i]%12==id_val){
      int x=disnow[i];
      rep(j,9){
        Save(now,x%2);
        x/=2;
        now++;
      }
    }else{
      Save(now,C[EA[i]]);
      now++;
    }
  }
}

Boris

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()

vector<int> bfsB(vector<vector<int>> G){
    int N=G.size();
    vector<int> dis(N,-1);
    dis[0]=0;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int v=que.front();
        que.pop();
        for(int nv:G[v]){
            if(dis[nv]!=-1) continue;
            dis[nv]=dis[v]+1;
            que.push(nv);
        }
    }
    return dis;
}

int NB;
vector<vector<int>> GB(550);
vector<int> disB;
vector<int> EB(550);
vector<int> par(550,-1);

void InitBoris(int N , int A[] , int B[]) {
  NB=N;
  rep(i,N) GB[A[i]].push_back(B[i]);
  rep(i,N) GB[B[i]].push_back(A[i]);
  disB=bfsB(GB);
  rep(i,N){
    if(disB[A[i]]>disB[B[i]]) EB[A[i]]=i,par[A[i]]=B[i];
    if(disB[B[i]]>disB[A[i]]) EB[B[i]]=i,par[B[i]]=A[i];
  }
}

int Boris(int city) {
  int N=NB;
  vector<int> cnt(12,0);
  rep(i,N) cnt[disB[i]%12]++;
  int min_val=550,id_val=-1;
  rep(i,12){
    if(min_val>cnt[i]){
      min_val=cnt[i];
      id_val=i;
    }
  }
  vector<vector<int>> D(N);
  int now=0;
  rep(i,N){
    if(i==0||disB[i]%12==id_val){
      rep(j,9){
        D[i].push_back(now);
        now++;
      }
    }else{
      D[i].push_back(now);
      now++;
    }
  }
  int ans=0;
  int v=city;
  while(1){
    if(v==0||disB[v]%12==id_val){
      int po=1;
      rep(j,9){
        ans+=Ask(D[v][j])*po;
        po*=2;
      }
      break;
    }else{
      ans+=Ask(D[v][0]);
      v=par[v];
    }
  }
  return ans;
}

详细

Anya.code: In function ‘void Anya(int*)’:
Anya.code:74:9: error: ‘Save’ was not declared in this scope
   74 |         Save(now,x%2);
      |         ^~~~
Anya.code:79:7: error: ‘Save’ was not declared in this scope
   79 |       Save(now,C[EA[i]]);
      |       ^~~~
grader_Anya.cpp: In function ‘int main(int, char**)’:
grader_Anya.cpp:54:13: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
   54 |   char *t = "/dev/null";
      |             ^~~~~~~~~~~
grader_Anya.cpp:110:14: warning: zero-length gnu_printf format string [-Wformat-zero-length]
  110 |   quitf(_ok, "");
      |              ^~