Submission #69958

#TimeUsernameProblemLanguageResultExecution timeMemory
69958TalantBroken Device (JOI17_broken_device)C++17
0 / 100
79 ms13632 KiB
#include "Annalib.h" #include <bits/stdc++.h> #define sc second #define fr first #define pb push_back #define mk make_pair using namespace std; string bin(long long x) { string a = ""; while(x) { a = (char)(x % 2 + '0') + a; x /= 2; } return a; } void Anna( int N, long long X, int K, int p[] ){ string s = bin(X); if (p[0] > s.size()) { for (int i = 0; i <= s.size(); i ++) { if (i == 0) Set(i,1); else { Set(i,(int)(s[i - 1] - '0')); } } for (int i = (int)(s.size()) + 1; i < N; i ++) Set(i,0); } else { int o = (N - (int)s.size() - 1); for (int i = o; i < N; i ++) { if (i == o) Set(i,1); else { Set(i,(int)(s[(int)s.size() - i + (o + 1) - 1] - '0')); } } for (int i = 0; i < o; i ++) Set(i,0); } }
#include "Brunolib.h" #include <bits/stdc++.h> #define sc second #define fr first #define pb push_back #define mk make_pair using namespace std; int id; long long ans; long long Bruno( int N, int A[] ){ for (int i = 0; i < N; i ++) { if (A[i]) { id = i + 1; break; } } for (int i = id; i < N; i ++) { ans += (1 << (i - id)) * A[i]; } return ans; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:23:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (p[0] > s.size()) {
           ~~~~~^~~~~~~~~~
Anna.cpp:24:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = 0; i <= s.size(); i ++) {
                             ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...