Submission #1297213

#TimeUsernameProblemLanguageResultExecution timeMemory
1297213nguyenkhangninh99Broken Device (JOI17_broken_device)C++20
Compilation error
0 ms0 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; void Anna(int n, long long x, int k, int p[]){ vector<int> bad(n), res(n); for(int i = 0; i < k; i++) bad[p[i]] = 1; for(int i = 0; i < n; i += 3){ if(bad[i] + bad[i + 1] + bad[i + 2] >= 2) continue; if(bad[i] + bad[i + 1] + bad[i + 2] == 1){ if(x % 2 == 0){ if(bad[i]) res[i + 2] = 1; else if(bad[i + 1]) res[i + 2] = 1; else res[i] = res[i + 1] = 1; }else{ if(bad[i]){ if(x % 4 == 1) res[i + 1] = 1; else res[i + 1] = res[i + 2] = 1; x /= 2; } if(bad[i + 1]) res[i] = 1; if(bad[i + 2]) res[i] = 1; } x /= 2; }else{ res[i] = res[i + 1] = res[i + 2] = 1; if(x % 4 == 1) res[i] = res[i + 2] = 0; else if(x % 4 == 2) res[i + 1] = 0; else if(x % 4 == 3) res[i] = 0; x /= 4; } } for(int i = 0; i < n; i++) Set(i, res[i]); }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; void update(int &res, int t){ if(t == 1) res *= 2; if(t == 2) res = res * 4 + 1; if(t == 3) res = res * 4 + 3; if(t == 4) res = res * 2 + 1; if(t == 5) res = res * 4 + 2; if(t == 6) res *= 2; if(t == 7) res *= 4; } long long Bruno(int n, int a[]){ long long res = 0; for(int i = n - 3; i >= 0; i -= 3) update(res, 4 * a[i] + 2 * a[i + 1] + a[i + 2]); return res; }

Compilation message (stderr)

# 2번째 컴파일 단계

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:17:47: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   17 |     for(int i = n - 3; i >= 0; i -= 3) update(res, 4 * a[i] + 2 * a[i + 1] + a[i + 2]);
      |                                               ^~~
Bruno.cpp:5:18: note:   initializing argument 1 of 'void update(int&, int)'
    5 | void update(int &res, int t){
      |             ~~~~~^~~