Submission #823768

#TimeUsernameProblemLanguageResultExecution timeMemory
823768AmylopectinFlight to the Ford (BOI22_communication)C++17
0 / 100
787 ms1720 KiB
#include"communication.h" #include <stdio.h> #include <iostream> #include <vector> #include <stdlib.h> #include <time.h> using namespace std; const int mxn = 510; int dran[mxn] = {}; void encode(int n, int x) { int i,j,cn,cm,fn,fm,cou = 0,cret,csta; srand(time(0)); for(i=0; i<410; i++) { if(rand() %3 == 2) { dran[i] = 1; } else { dran[i] = 0; } } for(i=0; i<30; i++) { if((1<<i) & x) { cn = 1; } else { cn = 0; } // cm = (cn + dran[cou]) & 1; cou ++; cret = send(cn); if(cret == cn) { csta = 0; } else { csta = 1; } while(1) { // cm = (cn + dran[cou]) & 1; cou ++; cret = send(cn); if(csta == 0) { if(cret == cn) { break; } } csta = (csta + 1) & 1; } } return ; } std::pair<int, int> decode(int n) { int i,j,m,cn,cm,fn,fm,cva = 0,be; for(i=0; i<30; i++) { be = receive(); while(1) { cn = receive(); if(cn == be) { cva += (cn<<i); break; } be = cn; } } return {cva,cva+1}; }

Compilation message (stderr)

communication.cpp: In function 'void encode(int, int)':
communication.cpp:12:11: warning: unused variable 'j' [-Wunused-variable]
   12 |     int i,j,cn,cm,fn,fm,cou = 0,cret,csta;
      |           ^
communication.cpp:12:16: warning: unused variable 'cm' [-Wunused-variable]
   12 |     int i,j,cn,cm,fn,fm,cou = 0,cret,csta;
      |                ^~
communication.cpp:12:19: warning: unused variable 'fn' [-Wunused-variable]
   12 |     int i,j,cn,cm,fn,fm,cou = 0,cret,csta;
      |                   ^~
communication.cpp:12:22: warning: unused variable 'fm' [-Wunused-variable]
   12 |     int i,j,cn,cm,fn,fm,cou = 0,cret,csta;
      |                      ^~
communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:66:11: warning: unused variable 'j' [-Wunused-variable]
   66 |     int i,j,m,cn,cm,fn,fm,cva = 0,be;
      |           ^
communication.cpp:66:13: warning: unused variable 'm' [-Wunused-variable]
   66 |     int i,j,m,cn,cm,fn,fm,cva = 0,be;
      |             ^
communication.cpp:66:18: warning: unused variable 'cm' [-Wunused-variable]
   66 |     int i,j,m,cn,cm,fn,fm,cva = 0,be;
      |                  ^~
communication.cpp:66:21: warning: unused variable 'fn' [-Wunused-variable]
   66 |     int i,j,m,cn,cm,fn,fm,cva = 0,be;
      |                     ^~
communication.cpp:66:24: warning: unused variable 'fm' [-Wunused-variable]
   66 |     int i,j,m,cn,cm,fn,fm,cva = 0,be;
      |                        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...