제출 #375158

#제출 시각아이디문제언어결과실행 시간메모리
375158Kevin_Zhang_TWNaan (JOI19_naan)C++17
0 / 100
26 ms748 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pb emplace_back #define AI(i) begin(i), end(i) template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); } template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); } #ifdef KEV #define DE(args...) kout("[ " + string(#args) + " ] = ", args) void kout() { cerr << endl; } template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); } template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l) == r], ++l; } #else #define DE(...) 0 #define debug(...) 0 #endif const int MAX_N = 2005; const ll sc = 1ll * 2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 * 23 ; int n, L; ll v[MAX_N][MAX_N]; ll cdiv(ll a, ll b) { return (a + b -1) / b; } int32_t main() { DE(sc); ios_base::sync_with_stdio(0), cin.tie(0); cin >> n >> L; for (int i = 0;i < n;++i) for (int j = 0;j < L;++j) cin >> v[i][j]; vector<int> od(n); iota(AI(od), 0); random_device rd; mt19937 gen(rd()); int holan = 5000; do { // gen bool ok = true; vector<ll> sep {0}; debug(AI(od)); const ll &dn = sc; for (int x : od) { ll sum = 0; for (int j = 0;j < L;++j) sum += v[x][j] * sc; ll up = sep.back(); ll atid = up / dn, lft = sc - up % dn; DE(x, atid, lft, dn); ll need = (sum + n-1) / n; DE(x, need); if (lft * v[x][atid] > need) { //if (frac(lft, dn) * v[x][atid] > need) { ll len = cdiv(need, v[x][atid]); //frac len = need / v[x][atid]; sep.pb(len + sep.back()); continue; } //need -= frac(lft, dn) * v[x][atid]; need -= v[x][atid] * lft; ++atid; while (atid < L) { if (need < v[x][atid] * sc) break; need -= v[x][atid++] * sc; } //if (atid == L && need > frac(0)) { if (atid == L && need > 0) { ok = false; break; } sep.pb(atid * sc + cdiv(need, v[x][atid])); DE(sep.back()); } if (!ok) continue; for (int i = 1;i < n;++i) cout << sep[i] << ' ' << sc << '\n'; for (int i = 0;i < n;++i) cout << od[i]+1 << " \n"[i+1==n]; return 0; } while (shuffle(AI(od), gen), holan--); cout << -1 << '\n'; }

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

naan.cpp: In function 'int32_t main()':
naan.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
naan.cpp:25:2: note: in expansion of macro 'DE'
   25 |  DE(sc);
      |  ^~
naan.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
naan.cpp:42:3: note: in expansion of macro 'debug'
   42 |   debug(AI(od));
      |   ^~~~~
naan.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
naan.cpp:54:4: note: in expansion of macro 'DE'
   54 |    DE(x, atid, lft, dn);
      |    ^~
naan.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
naan.cpp:58:4: note: in expansion of macro 'DE'
   58 |    DE(x, need);
      |    ^~
naan.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
naan.cpp:81:4: note: in expansion of macro 'DE'
   81 |    DE(sep.back());
      |    ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...