Submission #439261

#TimeUsernameProblemLanguageResultExecution timeMemory
439261hossain2020Shopping (JOI21_shopping)C++14
0 / 100
4 ms388 KiB
#include "Anna.h" #include <vector> #include <bits/stdc++.h> using namespace std; namespace { int n, l, r,k; int c,o; } // namespace vector <long long > v; void InitA(int N, int L, int R) { n= N; l= L; r= R; int a=r-l; for (int i=0;i<18;i++) { SendA(l%2); l/=2; } l=L; } void ReceiveA(bool x) { v.push_back(int(x)); } int Answer() { int o=0,s=0,k=l; for (int i=0;i<v.size();) { s=0; o=0; for (int j=0;j<18;j++) { o+=(1<<s)*v[i]; i++; s++; } o+=l; if (o<=r)k=o; } return k; }
#include "Bruno.h" #include <vector> #include <bits/stdc++.h> using namespace std; namespace { int n; int a[1000000]; int co,o,b,c; } void send(int y) { for (int i=0;i<18;i++) { SendB(y%2); y/=2; } } void InitB(int N, std::vector<int> P) { n= N; for(int i = 0; i < N; i++) { a[i]= P[i]; } } void ReceiveB(bool y) { o+=(1<<co)*int(y); co++; if (co==18) { b=a[o]; for (int i=o+1;i<n;i++) { if (a[i]<b) { b=a[i]; send(i-o); } } } }

Compilation message (stderr)

Anna.cpp: In function 'void InitA(int, int, int)':
Anna.cpp:19:7: warning: unused variable 'a' [-Wunused-variable]
   19 |   int a=r-l;
      |       ^
Anna.cpp: In function 'int Answer()':
Anna.cpp:35:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int i=0;i<v.size();)
      |                  ~^~~~~~~~~
Anna.cpp: At global scope:
Anna.cpp:10:7: warning: '{anonymous}::o' defined but not used [-Wunused-variable]
   10 | int c,o;
      |       ^
Anna.cpp:10:5: warning: '{anonymous}::c' defined but not used [-Wunused-variable]
   10 | int c,o;
      |     ^
Anna.cpp:9:13: warning: '{anonymous}::k' defined but not used [-Wunused-variable]
    9 | int n, l, r,k;
      |             ^

Bruno.cpp:11:12: warning: '{anonymous}::c' defined but not used [-Wunused-variable]
   11 | int co,o,b,c;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...