Submission #70155

#TimeUsernameProblemLanguageResultExecution timeMemory
70155Just_Solve_The_ProblemBroken Device (JOI17_broken_device)C++11
0 / 100
76 ms12992 KiB
#include <bits/stdc++.h> #include "Annalib.h" //#include "grader.cpp" #define pb push_back using namespace std; void Anna( int N, long long X, int K, int P[] ){ vector < int > used(N, 0); vector < int > u(N, 0); for (int i = 0; i < K; i++) { used[P[i]] = 1; } vector < int > p; for (int i = 0; i < 61; i++) { p.pb((X >> i) & 1); } vector < int > vec; int res = 1; for (int i = 1; i < 61; i++) { if (p[i] != p[i - 1]) { vec.pb(res); res = 0; } res++; } vec.pb(res); int cur = 0; for (int i = 1; i < K && cur < vec.size(); i++) { if (P[i] - 1 - P[i - 1] >= vec[cur]) { for (int j = P[i - 1] + 1; j < P[i - 1] + 1 + vec[cur]; j++) { u[j] = 1; } cur++; P[i - 1] += 1 + vec[cur]; i--; } } for (int i = 0; i < N; i++) { Set(i, u[i]); } }
#include <bits/stdc++.h> #include "Brunolib.h" //#include "grader.cpp" #define ll long long #define pb push_back using namespace std; long long Bruno( int N, int A[] ){ ll ret = 0; int cur = 60; vector < int > vec; int res = 0; for (int i = 0; i < N; i++) { if (A[i] == 1) { res++; } else { if (res) { vec.pb(res); } res = 0; } } if (res) vec.pb(res); reverse(vec.begin(), vec.end()); for (int i = 0; i < vec.size(); i++) { if (i & 1) { for (int j = 0; j < vec.size(); j++) { ret |= (1LL << cur); cur--; } } else { cur -= vec.size(); } } return ret; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:30:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 1; i < K && cur < vec.size(); i++) {
                            ~~~~^~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:28:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < vec.size(); i++) {
                   ~~^~~~~~~~~~~~
Bruno.cpp:30:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int j = 0; j < vec.size(); j++) {
                       ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...