Submission #70563

#TimeUsernameProblemLanguageResultExecution timeMemory
70563TalantBroken Device (JOI17_broken_device)C++17
0 / 100
6 ms1536 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'); x /= 2; } return a; } int u[200]; int ind; void Anna( int n, long long x, int k, int p[] ){ string s = bin(x); memset(u,0,sizeof(u)); ind = 0; for (int i = 0; i < k; i ++) u[p[i]] = 1; for (int i = 0; i < n; i ++) { if (ind >= (int)s.size()) { Set(i,0); continue; } if (i + 1 < n && u[i] + u[i + 1] < 1) { Set(i,1); Set(i + 1,(int)(s[ind] - '0')); ind ++; i ++; while (i + 1 < n && s[ind - 1] == '1' && s[ind] == '1' && ind < (int)s.size() && u[i + 1] == 0) { Set(i + 1,(int)(s[ind] - '0')); ind ++; i ++; } i ++; Set(i,0); } else { 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; long long ans; long long cnt; long long Bruno( int N, int a[] ){ ans = 0; cnt = 0; for (int i = 0; i < N - 1; i ++) { if (a[i] == 1) { ans += (1ll << cnt) * 1ll * a[i + 1]; // cout << i + 1 << endl; cnt ++; i ++; while (a[i] == 1 && a[i + 1] == 1 && i + 1 < N) { ans += (1ll << cnt) * 1ll * a[i + 1]; // cout << i + 1 << endl; cnt ++; i ++; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...