Submission #954872

#TimeUsernameProblemLanguageResultExecution timeMemory
954872alo_54Broken Device (JOI17_broken_device)C++14
0 / 100
2 ms1212 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; string desc(long long X) { string resp; while (X) { int mod = X % 2; if (mod == 1) { resp += "1"; }else { resp += "0"; } X /= 2; } while (resp.size() < 60) { resp += "0"; } reverse(resp.begin(), resp.end()); resp += resp; return resp; } void Anna( int N, long long X, int K, int P[] ) { string num = desc(X); for( int i = 0; i < 120; i++ ) { Set(i, num[i] ); } int wrongPos = P[0]; if (wrongPos < 120) { char r = num[wrongPos]; Set(120, r); }else { Set(120, 1); } for (int i = 121; i < N; i++) { Set(i, 1); } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; long long comp(string s) { reverse(s.begin(), s.end()); long long resp = 0; long long p2 = 1; for (int i = 0; i < s.size(); i++) { if (s[i] == '1') { resp += p2; } p2 *= 2; } return resp; } long long Bruno( int N, int A[] ) { string resp; for (int i = 0; i < 60; i++) { if (A[i] == A[i + 60]) { resp += A[i]; }else { resp += A[120]; } } long long X = comp(resp); return X; }

Compilation message (stderr)

Bruno.cpp: In function 'long long int comp(std::string)':
Bruno.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 0; i < s.size(); i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...