제출 #1247359

#제출 시각아이디문제언어결과실행 시간메모리
1247359_asunaaBroken Device (JOI17_broken_device)C++20
컴파일 에러
0 ms0 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; long long i, j, l, r, mid, p, q, k, t, n, m, b, c, d, ans, cnt, res, arr[1000005]; int a[40]; const long long mod = 999993143, mod2 = 999993469; bool check; void Set (int a, int b){ cout << b; } void Anna (int N, long long X, int K, int P[]){ string s = " "; while (X > 1){ s.push_back((char)(X % 2 + 48)); X /= 2; } s.push_back((char)(X + 48)); d = s.length() - 1; // cout << s << "\n"; p = 1; for (i = 1; i <= N; i += 1){ arr[i] = 0; } for (i = 0; i < K; i += 1){ arr[P[i]] = 1; } for (i = 1; i <= N; i += 3){ res = arr[i] + arr[i + 1] + arr[i + 2]; if (res >= 2 || p > d){ Set(i - 1, 0); Set(i, 0); Set(i + 1, 0); } else if (res == 1){ if (p == d){ s += "0"; } if (s[p] == 49){ if (arr[i] == 1){ Set(i - 1, 0); Set(i, 1); Set(i + 1, 1); } else{ Set(i - 1, 1); Set(i, 0); Set(i + 1, 0); } p += 1; } else{ if (arr[i + 2] == 1){ if (s[p + 1] == 48){ Set(i - 1, 0); Set(i, 1); Set(i + 1, 0); } else{ Set(i - 1, 1); Set(i, 1); Set(i + 1, 0); } p += 2; } else{ Set(i - 1, 0); Set(i, 0); Set(i + 1, 1); p += 1; } } } else{ if (p == d){ s += "0"; } if (s[p] == 49 && s[p + 1] == 49){ Set(i - 1, 1); Set(i, 1); Set(i + 1, 1); } else if (s[p] == 49 && s[p + 1] == 48){ Set(i - 1, 1); Set(i, 0); Set(i + 1, 1); } else if (s[p] == 48 && s[p + 1] == 49){ Set(i - 1, 1); Set(i, 1); Set(i + 1, 0); } else{ Set(i - 1, 0); Set(i, 1); Set(i + 1, 0); } p += 2; } } return; } //int main(){ // for (i = 0; i < 40; i += 1){ // a[i] = i * 2; // } // Anna(150, 1000000000000000000, 40, a); //}
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; long long i, j, l, r, mid, p, q, k, t, n, m, b, c, d, ans, cnt, res, arr[1000005]; int a[150]; const long long mod = 999993143, mod2 = 999993469; bool check; string ss = "001000001000001000001000001000001000001000001000001000001000001000001000001000010010110010111110111010101111101110101101111110101101010010111111110101"; long long Bruno (int N, int A[]){ string s; ans = 0; s = " "; for (i = 1; i <= N; i += 3){ if (A[i - 1] == 0 && A[i] == 0 && A[i + 1] == 0){ continue; } else if (A[i - 1] == 0 && A[i] == 0 && A[i + 1] == 1){ s += "0"; } else if (A[i - 1] == 0 && A[i] == 1 && A[i + 1] == 0){ s += "00"; } else if (A[i - 1] == 0 && A[i] == 1 && A[i + 1] == 1){ s += "1"; } else if (A[i - 1] == 1 && A[i] == 0 && A[i + 1] == 0){ s += "1"; } else if (A[i - 1] == 1 && A[i] == 0 && A[i + 1] == 1){ s += "10"; } else if (A[i - 1] == 1 && A[i] == 1 && A[i + 1] == 0){ s += "01"; } else{ s += "11"; } // cout << s << "\n"; } // cout << s << "\n"; for (i = 1; i < s.length(); i += 1){ ans += (long long)(s[i] - 48) * (1ll << (i - 1)); } return ans; } //int main(){ // for (i = 0; i < 150; i += 1){ // a[i] = (long long)(ss[i]) - 48; //// cout << a[i]; // } //// cout << "\n"; // cout << Bruno(150, a); //}

컴파일 시 표준 에러 (stderr) 메시지

# 1번째 컴파일 단계

/usr/bin/ld: /tmp/cc2rrAeg.o: in function `Set(int, int)':
grader_anna.c:(.text+0x60): multiple definition of `Set(int, int)'; /tmp/cc2YiDrA.o:Anna.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status