Submission #705427

#TimeUsernameProblemLanguageResultExecution timeMemory
705427lukameladzeBroken Device (JOI17_broken_device)C++14
Compilation error
0 ms0 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; // 1 ---- > 0 // 2 ---- > 1 // 5 ---- > 1 // 3 ---- > 10 // 4 ---- > 00 // 6 ---- > 01 // 7 ---- > 11 void Anna( int N, long long X, int K, int P[] ){ std::vector <int> bit, fix; bit = vector <int> (65, 0); fix = vector <int> (155, 0); for (int i = 0; i < 60; i++) { bit[i] = ((1LL<<i)&X ? 1 : 0); } for (int i = 0; i < K; i++) { fix[P[i]] = 1; } int cur = 0; for (int i = 0; i < 150; i+=3) { int bl = fix[i] + fix[i + 1] + fix[i + 2]; if (bl >= 2) { assign(i, 0); continue; } if (bl == 0) { int val = bit[cur] * 2 + bit[cur]; cur += 2; if (val == 3) { assign(i, 7); continue; } if (val == 0) { assign(i, 4); continue; } if (val == 1) { assign(i, 6); continue; } if (val == 2) { assign(i, 3); continue; } } assert(bl == 1); int val = bit[cur]; if (!fix[i + 2] && val == 0) { cur++; assign(i, 1); continue; } if (!fix[i + 1] && val == 1) { cur++; assign(i, 2); continue; } int val1 = bit[cur + 1]; if (val == 0) { // i da i + 1 emp if (val1 == 0) { assign(i, 4); cur += 2; continue; } if (val1 == 1) { assign(i, 6); cur += 2; continue; } } // i da i + 2 emp if (val1 == 0) { assign(i, 5); cur++; continue; } } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; // 1 ---- > 0 // 2 ---- > 1 // 5 ---- > 1 // 3 ---- > 10 // 4 ---- > 00 // 6 ---- > 01 // 7 ---- > 11 long long Bruno( int N, int A[] ){ string get[10]; get[1] = "0"; get[2] = "1"; get[5] = "1"; get[3] = "10"; get[4] = "00"; get[6] = "01"; get[7] = "11"; string ans = ""; for (int i = 0; i < 150; i += 3) { int x = A[i] * 4 + A[i + 1] * 2 + A[i + 2]; ans += get[x]; } long long res = 0; for (int i = 0; i < ans.size(); i++) { res += (ans[i] == '1' ? (1LL<<i) : 0); } return res; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:30:13: error: 'assign' was not declared in this scope; did you mean 'asin'?
   30 |             assign(i, 0);
      |             ^~~~~~
      |             asin
Anna.cpp:37:17: error: 'assign' was not declared in this scope; did you mean 'asin'?
   37 |                 assign(i, 7); continue;
      |                 ^~~~~~
      |                 asin
Anna.cpp:40:17: error: 'assign' was not declared in this scope; did you mean 'asin'?
   40 |                 assign(i, 4); continue;
      |                 ^~~~~~
      |                 asin
Anna.cpp:43:17: error: 'assign' was not declared in this scope; did you mean 'asin'?
   43 |                 assign(i, 6); continue;
      |                 ^~~~~~
      |                 asin
Anna.cpp:46:17: error: 'assign' was not declared in this scope; did you mean 'asin'?
   46 |                 assign(i, 3); continue;
      |                 ^~~~~~
      |                 asin
Anna.cpp:52:20: error: 'assign' was not declared in this scope; did you mean 'asin'?
   52 |             cur++; assign(i, 1); continue;
      |                    ^~~~~~
      |                    asin
Anna.cpp:55:20: error: 'assign' was not declared in this scope; did you mean 'asin'?
   55 |             cur++; assign(i, 2); continue;
      |                    ^~~~~~
      |                    asin
Anna.cpp:60:17: error: 'assign' was not declared in this scope; did you mean 'asin'?
   60 |                 assign(i, 4); cur += 2; continue;
      |                 ^~~~~~
      |                 asin
Anna.cpp:63:17: error: 'assign' was not declared in this scope; did you mean 'asin'?
   63 |                 assign(i, 6); cur += 2; continue;
      |                 ^~~~~~
      |                 asin
Anna.cpp:68:13: error: 'assign' was not declared in this scope; did you mean 'asin'?
   68 |             assign(i, 5); cur++; continue;
      |             ^~~~~~
      |             asin

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for (int i = 0; i < ans.size(); i++) {
      |                     ~~^~~~~~~~~~~~