제출 #445303

#제출 시각아이디문제언어결과실행 시간메모리
445303hhhhauraLottery (CEOI18_lot)C++14
100 / 100
1018 ms12912 KiB
#define wiwihorz #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma loop-opt(on) #define rep(i, a, b) for(int i = a; i <= b; i ++) #define rrep(i, a, b) for(int i = b; i >= a; i --) #define all(x) x.begin(), x.end() #define ceil(a, b) ((a + b - 1) / (b)) #define INF 1000000000000000000 #define MOD 1000000007 #define eps (1e-9) using namespace std; #define int long long int #define lld long double #define pii pair<int, int> #define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()) #ifdef wiwihorz #define print(a...) cerr << "Line " << __LINE__ << ": ", kout("[" + string(#a) + "] = ", a) void vprint(auto L, auto R) {while(L < R) cerr << *L << " \n"[next(L) == R], ++L;} void kout() { cerr << endl; } template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); } #else #define print(...) 0 #define vprint(...) 0 #endif namespace solver { int n, l, q; vector<int> pre, a, inv, ans; vector<pii> qq; vector<vector<int>> cnt; void init_(int _n, int _l) { n = _n, l = _l; a.assign(n + 1, 0); inv.assign(n + 1, 0); } void solve() { q = qq.size(); cnt.assign(n + 1, vector<int>(q + 2, 0)); ans.assign(q + 1, 0); sort(all(qq)); rep(i, 0, l) { inv[i] = lower_bound(all(qq), pii(i, -INF)) - qq.begin() + 1; } rep(i, 1, n - 1) { pre.assign(n + 1, 0); rep(j, 1, n - i) pre[j] = pre[j - 1] + bool(a[j] == a[j + i]); rep(j, 1, n - i - l + 1) { int v = pre[j + l - 1] - pre[j - 1]; cnt[j][inv[l - v]] ++; cnt[j + i][inv[l - v]] ++; } } rep(i, 1, n) rep(j, 1, q) cnt[i][j] += cnt[i][j - 1]; rep(i, 0, q - 1) ans[qq[i].second] = i + 1; rep(i, 0, q - 1) { rep(j, 1, n - l + 1) cout << cnt[j][ans[i]] << " \n"[j == n - l + 1]; } return; } }; using namespace solver; signed main() { ios::sync_with_stdio(false), cin.tie(0); int n, l; cin >> n >> l; init_(n, l); rep(i, 1, n) cin >> a[i]; int m; cin >> m; rep(i, 0, m - 1) { int k; cin >> k; qq.push_back({k, i}); } solve(); return 0; }

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

lot.cpp:4: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    4 | #pragma loop-opt(on)
      | 
lot.cpp:24:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) {while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |             ^~~~
lot.cpp:24:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) {while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |                     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...