제출 #982352

#제출 시각아이디문제언어결과실행 시간메모리
982352parlimoosTwo Transportations (JOI19_transportations)C++14
0 / 100
207 ms664 KiB
//Be Name KHODA #pragma GCC optimize("Ofast") #include<bits/stdc++.h> #include "Azer.h" using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define pp pop_back #define lb lower_bound #define ub upper_bound #define cl clear #define bg begin #define arr(x) array<int , x> #define endl '\n' int nA , mA , dstA[2000]; vector<arr(2)> gA[2000]; set<arr(2)> qA; int lstA = 0; int rcvA[3] , xxA[2]; vector<int> AA; void sendInfA(int x , int len){ if(x = min(x , 501)); // cout << "A : " << x << " " << len << ".\n"; for(int bit = len - 1 ; bit >= 0 ; bit--) SendA((x >> bit) & 1); } vector<int> Answer(){ return AA; } void addVtxA(int v , int x){ qA.erase({dstA[v] , v}); dstA[v] = x , lstA = x; for(auto &e : gA[v]){ if(dstA[e[0]] > dstA[v] + e[1]){ qA.erase({dstA[e[0]] , e[0]}); dstA[e[0]] = dstA[v] + e[1]; qA.insert({dstA[e[0]] , e[0]}); } } if(qA.empty()){ for(int i = 0 ; i < nA ; i++) AA.pb(dstA[i]); return; } auto itr = qA.bg(); rcvA[0] = 9 , rcvA[1] = 0 , rcvA[2] = 0; xxA[0] = (*itr)[1] , xxA[1] = (*itr)[0] - lstA; sendInfA((*itr)[0] - lstA , 9); } void gotLenA(int len){ // cout << len << "--\n"; if(xxA[1] <= len){ sendInfA(xxA[0] , 11); addVtxA(xxA[0] , xxA[1] + lstA); }else{ xxA[1] = len , rcvA[0] = 11 , rcvA[1] = 0 , rcvA[2] = 1; } } void ReceiveA(bool x){ if(rcvA[0] == 0) rcvA[0] = 11 , rcvA[1] = 0 , rcvA[1] = 1; rcvA[1] += (x << (rcvA[0] - 1)); if(--rcvA[0] == 0){ if(rcvA[2] == 0) gotLenA(rcvA[1]); else{ addVtxA(rcvA[1] , xxA[1] + lstA); } } } void InitA(int N , int A , vector<int> U , vector<int> V , vector<int> C){ nA = N , mA = A; fill(&dstA[0] , &dstA[nA] , int(1e9)); for(int v = 0 ; v < nA ; v++) qA.insert({dstA[v] , v}); for(int i = 0 ; i < mA ; i++) gA[U[i]].pb({V[i] , C[i]}) , gA[V[i]].pb({U[i] , C[i]}); addVtxA(0 , 0); }
//Be Name KHODA #pragma GCC optimize("Ofast") #include<bits/stdc++.h> #include "Baijan.h" using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define pp pop_back #define lb lower_bound #define ub upper_bound #define cl clear #define bg begin #define arr(x) array<int , x> #define endl '\n' int nB , mB , dstB[2000]; vector<arr(2)> gB[2000]; set<arr(2)> qB; int lstB = 0; int rcvB[3] , xxB[2]; void sendInfB(int x , int len){ x = min(x , 501); // cout << "B : " << x << " " << len << ".\n"; for(int bit = len - 1 ; bit >= 0 ; bit--) SendB((x >> bit) & 1); } void addVtxB(int v , int x){ qB.erase({dstB[v] , v}); dstB[v] = x , lstB = x; for(auto &e : gB[v]){ if(dstB[e[0]] > dstB[v] + e[1]){ qB.erase({dstB[e[0]] , e[0]}); dstB[e[0]] = dstB[v] + e[1]; qB.insert({dstB[e[0]] , e[0]}); } } auto itr = qB.bg(); rcvB[0] = 9 , rcvB[1] = 0 , rcvB[2] = 0; xxB[0] = (*itr)[1] , xxB[1] = (*itr)[0] - lstB; } void gotLenB(int len){ // cout << len << "---\n"; if(xxB[1] <= len){ sendInfB(xxB[1] , 9); int d = xxB[0]; addVtxB(xxB[0] , xxB[1] + lstB); sendInfB(d , 11); }else{ int d = xxB[1]; rcvB[0] = 11 , rcvB[1] = 0 , rcvB[2] = 1 , xxB[1] = len; sendInfB(d , 9); } } void ReceiveB(bool x){ if(rcvB[0] == 0) rcvB[0] = 9 , rcvB[1] = 0 , rcvB[2] = 0; rcvB[1] += (x << (rcvB[0] - 1)); if(--rcvB[0] == 0){ if(rcvB[2] == 0) gotLenB(rcvB[1]); else addVtxB(rcvB[1] , xxB[1] + lstB); } } void InitB(int N , int B , vector<int> S , vector<int> T , vector<int> D){ nB = N , mB = B; fill(&dstB[0] , &dstB[nB] , int(1e9)); for(int v = 0 ; v < nB ; v++) qB.insert({dstB[v] , v}); for(int i = 0 ; i < mB ; i++) gB[T[i]].pb({S[i] , D[i]}) , gB[S[i]].pb({T[i] , D[i]}); addVtxB(0 , 0); }

컴파일 시 표준 에러 (stderr) 메시지

Azer.cpp: In function 'void sendInfA(int, int)':
Azer.cpp:26:8: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   26 |   if(x = min(x , 501));
      |      ~~^~~~~~~~~~~~~~
Azer.cpp:26:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   26 |   if(x = min(x , 501));
      |   ^~
Azer.cpp:28:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   28 |  for(int bit = len - 1 ; bit >= 0 ; bit--) SendA((x >> bit) & 1);
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...