제출 #1218097

#제출 시각아이디문제언어결과실행 시간메모리
1218097thdh__Super Dango Maker (JOI22_dango3)C++20
100 / 100
2316 ms712 KiB
#include "dango3.h" #include <bits/stdc++.h> #define ll long long #define pb push_back #define eb emplace_back #define pu push #define ins insert #define fi first #define se second #define all(a) a.begin(),a.end() #define bruh ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define fu(x,a,b) for (auto x=a;x<=b;x++) #define fd(x,a,b) for (auto x=a;x>=b;x--) using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") //mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); /* Competitive Programming notes that I need to study & fix my dumbass self: 1. Coding: - Always be sure to check the memory of arrays (maybe use vectors), for loops, I don't know - Always try to maximize the memory if possible, even if you are going for subtasks - Do not exploit #define int long long, it will kill you 2. Stress: - Don't be cocky and think stressing with your dumbass brute-force solution will give you guaranteed AC. - Always try generating big testcases and try if they run 3. Time management: - Don't overcommit or undercommit, always spend a certain amount of time to think a problem, don't just look at it and say I'm fucked - Do not spend too much time coding brute-force solutions, they should be easily-codable solutions that don't take up too much time I hate offline because I am dumb */ typedef pair<int, int> ii; const int N = 2e5+5; const int mod = 1e9+7; const int inf = 1e18; using cd = complex<double>; const long double PI = acos(-1); int power(int a,int b) {ll x = 1;if (a >= mod) a%=mod; while (b) {if (b & 1) x = x*a % mod;a = a*a % mod;b>>=1;}return x;} void Solve(int N, int M) { int n = N,m = M; vector<bool> used(N*M+1); vector<vector<int>> g(M+1); int cnt = 0; for (int i = 1; i <= n*m; i++) { int l = 0, r = cnt, res = cnt; while (l <= r) { int mid = l+r>>1; for (int j = 1; j <= n*m; j++) used[j] = 0; used[i] = 1; for (int j = l; j <= mid; j++) for (auto k : g[j]) used[k] = 1; vector<int> q; for (int j = 1; j <= n*m; j++) if (!used[j]) q.pb(j); if (Query(q) == m-(mid-l+1)) res = mid, r = mid-1; else l = mid+1; } g[res].pb(i); if (cnt < m-1 && res == cnt) ++cnt; } for (int i = 0; i < m; i++) Answer(g[i]); }

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

dango3.cpp:42:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   42 | const int inf = 1e18;
      |                 ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...