Submission #567434

#TimeUsernameProblemLanguageResultExecution timeMemory
567434hhhhauraPainting Walls (APIO20_paint)C++14
15 / 100
1557 ms5836 KiB
#include "paint.h" #include <vector> #define wiwihorz #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("sse") #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 ll long long int #define lld long double #define pii pair<int, int> #define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()) #define INF 1000000000000000000 #define MOD 1000000007 #define eps (1e-9) using namespace std; #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 using namespace std; int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) { vector<set<int>> col(M, set<int>()); rep(i, 0, M - 1) { for(auto j : B[i]) col[i].insert(j); } vector<int> to(N, 0); rep(i, 0, M - 1) rep(j, 0, N - M) { if(to[j]) continue; bool yes = 1; rep(l, 0, M - 1) { int cur = (i + l) % M; yes &= (col[cur].find(C[j + l]) != col[cur].end()); } to[j] = yes; } int cnt = 0, cur = 0; set<int> s; rep(i, 0, N - 1) if(to[i]) s.insert(i); while(cur < N) { auto it = s.upper_bound(cur); if(it == s.begin()) return -1; it = prev(it); if(*it + M <= cur) return -1; cur = *it + M; cnt ++; } return cnt; }

Compilation message (stderr)

paint.cpp:8: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    8 | #pragma loop-opt(on)
      | 
paint.cpp:23:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   23 | void vprint(auto L,auto R){while(L<R)cerr<<*L<<" \n"[next(L) == R], ++L; }
      |             ^~~~
paint.cpp:23:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   23 | 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...