Submission #1309214

#TimeUsernameProblemLanguageResultExecution timeMemory
1309214vtnoo벽 칠하기 (APIO20_paint)C++20
0 / 100
1595 ms572 KiB
#include <bits/stdc++.h> #define L(i, j, k) for(int i = (j); i <= (k); i++) #define R(i, j, k) for(int i = (j); i >= (k); i--) #define ll long long #define sz(a) ((int) a.size()) #define all(a) a.begin(), a.end() #define vi vector<int> #define pb emplace_back #define me(a, x) memset(a, x, sizeof(a)) #define fst first #define snd second #define ii pair<int, int> using namespace std; int f[205][505]; int minimumInstructions(int N, int M, int K, std::vector<int> C, std::vector<int> A, std::vector<std::vector<int>> B) { vi r(N); L(i,0,M-1){ L(j,0,A[i]-1){ f[i][B[i][j]]=1; //puedo pintar estos colores con el contractor i } } auto valid=[&](int x,int y)->bool{ L(i,0,M-1){ if(!f[y][C[x]])return false; x++,y++,y%=M; } return true; }; L(x,0,N-M){ L(y,0,M){ if(valid(x,y)){ r[x]=max(r[x],x+M-1); } } } int i=0,ans=0; while(i<N){ i=r[i]; ans++; i++; } return ans; }
#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...