Submission #1078391

#TimeUsernameProblemLanguageResultExecution timeMemory
1078391antonBroken Device (JOI17_broken_device)C++17
0 / 100
2 ms1056 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; #define ll long long void Anna( int N, long long X, int K, int P[] ){ vector<int> info_bits; while(X>0){ info_bits.push_back(X%2LL); X/=2LL; } vector<bool> broken(N, false); for(int i = 0; i<K; i++){ broken[P[i]] = true; } int cur_id = 0; for(int i = 0; i<info_bits.size(); i++){ while(broken[cur_id] || broken[cur_id+1]){ Set(cur_id, 0); cur_id++; } Set(cur_id, 1); Set(cur_id+1, info_bits[i]); cur_id+=2; } while(cur_id<N){ Set(cur_id, 0); cur_id++; } }
#include "Brunolib.h" #include<bits/stdc++.h> using namespace std; #define ll long long long long Bruno( int N, int A[] ){ vector<int> bits; for(int i = 0; i<N; i++){ if(A[i]>0){ bits.push_back(A[i+1]); i+=2; } } ll res= 0; for(ll i = 0; i<bits.size(); i++){ if(bits[i]>0){ res |= (1LL<<i); } } return res; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for(int i = 0; i<info_bits.size(); i++){
      |                  ~^~~~~~~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:17:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(ll i = 0; i<bits.size(); i++){
      |                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...