QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#722873#67. Two TransportationsL_WaveCompile Error//C++203.3kb2024-11-07 20:28:412024-11-07 20:28:41

Judging History

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

  • [2024-11-07 20:28:41]
  • 评测
  • [2024-11-07 20:28:41]
  • 提交

Azer

// ---------------- A ----------------

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i <= i##ABRACADABRA; i++)
#define drep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i >= i##ABRACADABRA; i--)
using namespace std;
using ll = long long;

#ifndef LOCAL
#include"Azer.h"
#endif

namespace A{
  int n,m,U[2]={11,9},ty,num,V[2],v,lst,now,dis[3010];
  bool vis[3010];
  vector<pair<int,int>>G[3010];
  void S(int x,int t){
    // printf("A send: x=%d\n",x);
    drep(i,t-1,0)SendA(x>>i&1);
  }
  bool ins(bool x){
    V[ty]=V[ty]<<1|x;
    return --num;
  }
  void sty(int nt){
    V[ty=nt]=0;
    num=U[nt];
  }
  void upd(int u,int d){
    // printf("A upd: u=%d,d=%d\n",u,d);
    lst=dis[u]=d,vis[u]=1;
    for (auto [v,w]:G[u])
      if (dis[v]>w+d)dis[v]=w+d;
    v=n;
    rep(i,1,n)if (!vis[i]&&dis[v]>dis[i])v=i;
    now=dis[v];
    sty(1),S(now-lst,U[1]);
    // printf("A get v=%d\n",v);
  }
  void InitA(int _n,int _m,vector<int>u,vector<int>v,vector<int>w){
    memset(dis,0x3f,sizeof(dis));
    memset(vis,0,sizeof(vis));
    n=_n,m=_m;
    rep(i,0,m-1){
      G[u[i]].push_back({v[i],w[i]});
      G[v[i]].push_back({u[i],w[i]});
    }
    upd(0,0);
  }
  void ReceiveA(bool x){
    if (ins(x))return ;
    if (!ty)upd(V[0],V[1]+lst);
    else{
      // printf("A rec w=%d\n",V[1]);
      if (V[1]+lst>=now){ // change to > when B
        // puts("A win now");
        if (v!=n){
          S(v,U[0]);
          upd(v,now);
        }
      }else
        sty(0);
    }
  }
  vector<int>Answer(){
    vector<int>res(n);
    rep(i,0,n-1)res[i]=dis[i];
    return res;
  }
}

using A::InitA;
using A::ReceiveA;
using A::Answer;

Baijan

// ---------------- B ----------------

#ifndef LOCAL
#include"Baijan.h"
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i <= i##ABRACADABRA; i++)
#define drep(i, a, b) for (int i = (a), i##ABRACADABRA = (b); i >= i##ABRACADABRA; i--)
using namespace std;
using ll = long long;
#endif

namespace B{
  int n,m,U[2]={11,9},ty,num,V[2],v,lst,now,dis[3010];
  bool vis[3010];
  vector<pair<int,int>>G[3010];
  void S(int x,int t){
    // printf("B send: x=%d\n",x);
    drep(i,t-1,0)SendB(x>>i&1);
  }
  bool ins(bool x){
    V[ty]=V[ty]<<1|x;
    return --num;
  }
  void sty(int nt){
    V[ty=nt]=0;
    num=U[nt];
  }
  void upd(int u,int d){
    // printf("B upd: u=%d,d=%d\n",u,d);
    lst=dis[u]=d,vis[u]=1;
    for (auto [v,w]:G[u])
      if (dis[v]>w+d)dis[v]=w+d;
    v=n;
    rep(i,1,n)if (!vis[i]&&dis[v]>dis[i])v=i;
    now=dis[v];
    sty(1),S(now-lst,U[1]);
    // printf("B get v=%d\n",v);
  }
  void InitB(int _n,int _m,vector<int>u,vector<int>v,vector<int>w){
    memset(dis,0x3f,sizeof(dis));
    memset(vis,0,sizeof(vis));
    n=_n,m=_m;
    rep(i,0,m-1){
      G[u[i]].push_back({v[i],w[i]});
      G[v[i]].push_back({u[i],w[i]});
    }
    upd(0,0);
  }
  void ReceiveB(bool x){
    if (ins(x))return ;
    if (!ty)upd(V[0],V[1]);
    else{
      // printf("B rec w=%d\n",V[1]);
      if (V[1]+lst>now){ // change to >= when A
        // puts("B win now");
        if (v!=n){
          S(v,U[0]);
          upd(v,now);
        }
      }else
        sty(0);
    }
  }
}

using B::InitB;
using B::ReceiveB;

Details

Azer.code:72:10: error: ‘void A::InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)’ conflicts with a previous declaration
   72 | using A::InitA;
      |          ^~~~~
In file included from Azer.code:10:
Azer.h:3:6: note: previous declaration ‘void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)’
    3 | void InitA(int N, int A, std::vector<int> U, std::vector<int> V,
      |      ^~~~~
Azer.code:73:10: error: ‘void A::ReceiveA(bool)’ conflicts with a previous declaration
   73 | using A::ReceiveA;
      |          ^~~~~~~~
In file included from Azer.code:10:
Azer.h:5:6: note: previous declaration ‘void ReceiveA(bool)’
    5 | void ReceiveA(bool x);
      |      ^~~~~~~~
Azer.code:74:10: error: ‘std::vector<int> A::Answer()’ conflicts with a previous declaration
   74 | using A::Answer;
      |          ^~~~~~
In file included from Azer.code:10:
Azer.h:6:18: note: previous declaration ‘std::vector<int> Answer()’
    6 | std::vector<int> Answer();
      |                  ^~~~~~
grader_Azer.cpp: In function ‘int main(int, char**)’:
grader_Azer.cpp:37:13: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
   37 |   char *t = "/dev/null";
      |             ^~~~~~~~~~~