제출 #365400

#제출 시각아이디문제언어결과실행 시간메모리
365400kostia244popa (BOI18_popa)C++17
37 / 100
285 ms392 KiB
#pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx,avx2,sse,sse2") #ifdef EVAL #include"popa.h" #endif #include<bits/stdc++.h> #define all(x) begin(x), end(x) using namespace std; using ll = long long; namespace local { int ar[10010], qc = 0; int query(int a, int b, int c, int d) { qc++; int x = 0, y = 0; for(;a<=b;a++) x = __gcd(x, ar[a]); for(;c<=d;c++) y = __gcd(y, ar[c]); return x==y; } }; #ifndef EVAL using namespace local; #endif int fml(int l, int r, int *L, int *R) { if(l >= r) return -1; if(l+1 == r) return l; for(int x = l; x < r; x++) if(query(l, r-1, x, x)) { L[x] = fml(l, x, L, R); R[x] = fml(x+1, r, L, R); return x; } } int solve(int n, int *L, int *R) { vector<int> st; int rt = -1; vector<int> start(n); for(int i = 0; i < n; i++) L[i] = R[i] = -1; return fml(0, n, L, R); } #ifndef EVAL int main() { cin.tie(0)->sync_with_stdio(0); //multitest([&](){}); int n; cin >> n; for(int i = 1; i <= n; i++) cin >> ar[i]; vector<int> L(n), R(n); cout << solve(n, L.data(), R.data()) << endl; for(int i = 0; i < n; i++) cout << L[i] << " " << R[i] << '\n'; cout << " :: " << qc << endl; } #endif

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

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:38:6: warning: unused variable 'rt' [-Wunused-variable]
   38 |  int rt = -1;
      |      ^~
popa.cpp: In function 'int fml(int, int, int*, int*)':
popa.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...