Submission #64224

#TimeUsernameProblemLanguageResultExecution timeMemory
64224zadrgaBroken Device (JOI17_broken_device)C++14
0 / 100
570 ms21552 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second #define INF (1LL << 55) #define MOD (1000 * 1000 * 1000 + 7) #define maxn 1000111 typedef long long ll; typedef long double ld; typedef pair<int, int> pii; vector<int> v, block; int arr[maxn]; void Anna(int N, long long X, int K, int P[]){ // cout << N << " " << X << " " << K<< endl; v.clear(); block.clear(); memset(arr, 0, sizeof(arr)); for(int i = 0; i < 60; i++){ if((X >> i) & 1) v.pb(1); else v.pb(0); } block.pb(-1); for(int i = 0; i < K; i++) block.pb(P[i]); block.pb(N + 1); memset(arr, 0, sizeof(arr)); int ind = 0; for(int i = 1; i < block.size(); i++){ int x = block[i - 1] + 1; while(ind < v.size() && block[i] - x >= 3){ arr[x++] = 1; arr[x++] = v[ind++]; arr[x++] = v[ind++]; } } for(int i = 0; i < N; i++){ Set(i, arr[i]); // cout << i << " "<< arr[i] << endl; } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define fi first #define se second #define INF (1LL << 55) #define MOD (1000 * 1000 * 1000 + 7) #define maxn 1000111 typedef long long ll; typedef long double ld; typedef pair<int, int> pii; vector<int> v1; long long Bruno( int N, int A[]){ v1.clear(); for(int i = 0; i < N; i++){ if(A[i] == 1){ v1.pb(A[i + 1]); v1.pb(A[i + 2]); i += 2; } } ll ret = 0; for(int i = 0; i < v1.size(); i++) ret += (1 << i) * v1[i]; // cout << ret << endl; return ret; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:41:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < block.size(); i++){
                 ~~^~~~~~~~~~~~~~
Anna.cpp:44:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(ind < v.size() && block[i] - x >= 3){
         ~~~~^~~~~~~~~~

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