Submission #1207064

#TimeUsernameProblemLanguageResultExecution timeMemory
1207064friendiksHack (APIO25_hack)C++20
25 / 100
69 ms428 KiB
#ifndef LOCAL #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC diagnostic ignored "-Wpedantic" #endif #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; auto seed = chrono::high_resolution_clock::now().time_since_epoch().count(); mt19937_64 rnd(52); template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T, typename V> using table = gp_hash_table<T, V>; using i128 = __int128; using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; const ll INF = 2e18; const int inf = 2e9; const int maxn = 1e5; const int MOD = 988244353; const ld pi = acos(-1); const int P = 5167; const int L = 26; const ld EPS = 1e-7; template<typename T, typename V> void fill(T &container, V value) { for (auto &c: container) c = value; } int N; ll collisions(std::vector<long long> x); int bs = 500; int hack() { ll cols = 0; vector<ll> A(bs); while (cols == 0) { for (int i = 0; i < bs; ++i) A[i] = rnd() % (ll) (1e10) + 1; cols = collisions(A); } for (int i = 0; i < bs; ++i) { for (int j = i + 1; j < bs; ++j) { if (collisions({A[i], A[j]})) { ll mn = INF; for (ll d = 1; d * d <= abs(A[i] - A[j]); ++d) { if (abs(A[i] - A[j]) % d == 0) { ll d1 = abs(A[i] - A[j]) / d; if (collisions({1, 1 + d1})) { mn = min(mn, d1); } if (collisions({1, 1 + d})) { mn = min(mn, d); } } } return mn; } } } } int mai1n() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); cin >> N; cout << hack(); }

Compilation message (stderr)

hack.cpp: In function 'int mai1n()':
hack.cpp:80:1: warning: no return statement in function returning non-void [-Wreturn-type]
   80 | }
      | ^
hack.cpp: In function 'int hack()':
hack.cpp:73:1: warning: control reaches end of non-void function [-Wreturn-type]
   73 | }
      | ^
hack.cpp: In function 'int mai1n()':
hack.cpp:76:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   76 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
hack.cpp:77:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   77 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...