제출 #589280

#제출 시각아이디문제언어결과실행 시간메모리
589280Do_you_copyGondola (IOI14_gondola)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <gondola.h> #define taskname "test" #define fi first #define se second #define pb push_back #define faster ios_base::sync_with_stdio(0); cin.tie(0); using namespace std; using ll = long long; using pii = pair <int, int>; using pil = pair <int, ll>; using pli = pair <ll, int>; using pll = pair <ll, ll>; using ull = unsigned ll; mt19937 Rand(chrono::steady_clock::now().time_since_epoch().count()); ll min(const ll &a, const ll &b){ return (a < b) ? a : b; } ll max(const ll &a, const ll &b){ return (a > b) ? a : b; } const ll Mod = 1000000007; const ll Mod2 = 999999999989; const int maxN = 1e5 + 1; int n; int valid(int N, int inputSeq[]){ n = N; int pivot, cnt = 0, tem = INT_MAX; for (int i = 0; i < n; ++i){ if (inputSeq[i] > n) ++cnt; if (tem > inputSeq[i]){ tem = inputSeq[i]; pivot = i; } } if (cnt == n) return 1; //pivot is where the number one is supposed to be at pivot = ((pivot - tem + 1) + n) % n; for (int i = pivot; i < pivot + n; ++i){ if (inputSeq[i % n] <= n && inputSeq[i % n] != i - pivot + 1){ return 0; } } return 1; } /* void Init(){ int a[] = {10, 4, 3, 11, 12}; cerr << valid(5, a); } int main(){ if (fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); //freopen(taskname".out", "w", stdout); } faster; ll tt = 1; //cin >> tt; while (tt--){ Init(); } } */

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

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:43:21: warning: 'pivot' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 |     pivot = ((pivot - tem + 1) + n) % n;
      |               ~~~~~~^~~~~
/usr/bin/ld: /tmp/ccTwYHHT.o: in function `main':
grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x132): undefined reference to `replacement'
collect2: error: ld returned 1 exit status