Submission #535315

#TimeUsernameProblemLanguageResultExecution timeMemory
535315KoyingCollecting Stamps 3 (JOI20_ho_t3)C++14
0 / 100
2089 ms212 KiB
#include <bits/stdc++.h> #define int long long #pragma GCC optimize("Ofast") #define max(a, b) (a > b ? a : b) #define min(a, b) (a < b ? a : b) #define cmax(a, b) a = max(a, b) #define cmin(a, b) a = min(a, b) #define MEM(x, n) memset(x, n, sizeof(x)) #define pii pair<int, int> #define pdd pair<double, double> #define DB(x) cerr << #x << " " << x << endl; #define endl "\n" #define Koying ios::sync_with_stdio(0), cin.tie(0) #define lowbit(x) x &(-x) #define F first #define S second const int INF = 0x3f3f3f3f3f3f3f3f; using namespace std; #define MAXN 205 int n, l; pii x[MAXN]; /*void sol1() { pii dp[1 << 15]; MEM(dp, 0); for (int mask = 1; i < (n << 15); mask++) { int cnt = 0; for (int i = 0; i < n; i++) { cnt++; if (mask & (1 << i)) { int tarmask = mask - (1 << i); if (dp[tarmask].S + abs(x)) int owo; } } } }*/ pii dp[MAXN][MAXN * MAXN]; int ans = 0; bitset<MAXN> vis; void dfs(int i, int time, int depth) { vis[i] = true; //cout << i << endl; cmax(ans, depth); for (int e = 1; e <= n; e++) { if (!vis[e] && time + min((x[i].S - x[e].S + l) % l, (x[e].S - x[i].S + l) % l) <= x[e].F) { dfs(e, time + min((x[i].S - x[e].S + l) % l, (x[e].S - x[i].S + l) % l), depth + 1); } } vis[i] = false; } void sol() { cin >> n >> l; for (int i = 1; i <= n; i++) cin >> x[i].S; for (int i = 1; i <= n; i++) cin >> x[i].F; /*if (n <= 15) { sol1(); return; }*/ sort(x, x + n); for (int i = 1; i <= n; i++) { if (min(x[i].S, l - x[i].S) <= x[i].F) dfs(i, min(x[i].S, l - x[i].S), 1); } cout << ans << endl; } signed main() { Koying; int t = 1; //cin >> t; sol(); return 0; }

Compilation message (stderr)

ho_t3.cpp: In function 'int main()':
ho_t3.cpp:80:9: warning: unused variable 't' [-Wunused-variable]
   80 |     int t = 1;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...