Submission #587648

#TimeUsernameProblemLanguageResultExecution timeMemory
587648LastRoninFlights (JOI22_flights)C++17
Compilation error
0 ms0 KiB
#include "Benjamin.h" #include <string> #include <vector> #include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; namespace { int n, x, y; } std::string SendB(int N, int X, int Y) { x = X; y = Y; n = N; string a; for(int j = 0; j < 14; j++) { if((1<<j)&x)a += "1"; else a += "0"; } for(int j = 0; j < 6; j++) if((1<<j)&y) a += "1"; else a += "0"; //if(a.size() == 20)exit(0); return a; } int Answer(std::string T) { int sub = ((1<<6) - 1)&y; int pos = 0; int answ = 0; for(int j = 0; j < n; j++) { // if((j&sub) == sub) { if(j == y) { for(int i = pos; i < pos + 14; i++) { if(T.size() <= i)exit(0); answ += (T[i] == '1' ? 1 : 0) * (1<<(i - pos)); } return answ; } else { pos += 14; } // } } return 0; }
#include "Benjamin.h" #include <string> #include <vector> #include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; namespace { int n, x, y; } std::string SendB(int N, int X, int Y) { x = X; y = Y; n = N; string a; for(int j = 0; j < 14; j++) { if((1<<j)&x)a += "1"; else a += "0"; } for(int j = 0; j < 6; j++) if((1<<j)&y) a += "1"; else a += "0"; //if(a.size() == 20)exit(0); return a; } int Answer(std::string T) { int sub = ((1<<6) - 1)&y; int pos = 0; int answ = 0; for(int j = 0; j < n; j++) { // if((j&sub) == sub) { if(j == y) { for(int i = pos; i < pos + 14; i++) { if(T[i] == '1') answ += (1ll<<(i - pos)); } return answ; } else { pos += 14; } // } } return 0; }

Compilation message (stderr)

Ali.cpp: In function 'int Answer(std::string)':
Ali.cpp:38:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |      if(T.size() <= i)exit(0);
      |         ~~~~~~~~~^~~~
Ali.cpp:31:6: warning: unused variable 'sub' [-Wunused-variable]
   31 |  int sub = ((1<<6) - 1)&y;
      |      ^~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~
/usr/bin/ld: /tmp/cclh8pXv.o: in function `main':
grader_ali.cpp:(.text.startup+0x3bb): undefined reference to `Init(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader_ali.cpp:(.text.startup+0x569): undefined reference to `SendA(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status

Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:31:6: warning: unused variable 'sub' [-Wunused-variable]
   31 |  int sub = ((1<<6) - 1)&y;
      |      ^~~