Submission #425118

#TimeUsernameProblemLanguageResultExecution timeMemory
425118TryMaxVision Program (IOI19_vision)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#pragma GCC optimize("O3") //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") using namespace std; #define f first #define s second #define ll long long #define pb push_back #define ld long double const int N = 1e5 + 10, mod = 1e9 + 7, T = 2000 + 10; const ld eps = 0.9, e = 2.7, minT = 0.00001; mt19937 rnd(time(NULL)); int n; vector<pair<int, int>> a, ans; int res(vector<pair<int, int>> & a){ pair<int, int> was = {0, 0}, last = {0, 0}; vector<pair<int, int>> res; for(int i = 0; i < n; ++i){ pair<int, int> now = {a[i].f - last.f, a[i].s - last.s}; if(now.f * was.f > 0){ res.pb({a[i].f, last.s}); was = {0, now.s}; }else if(now.s * was.s > 0){ res.pb({last.f, a[i].s}); was = {now.f, 0}; }else{ if(last.f != 0 || last.s != 0) res.pb(last); pair<int, int> nxt = {a[i + 1].f - a[i].f, a[i + 1].s - a[i].s}; if(nxt.f * now.f > 0){ res.pb({last.f, a[i].s}); was = {now.f, 0}; }else{ res.pb({a[i].f, last.s}); was = {0, now.s}; } } last = a[i]; } res.pb(a[n - 1]); if(res.size() < ans.size() || ans.empty()) ans = res; return res.size(); } bool chance(ld c){ int maxn = 1000000; ld num = (ld)(rnd() % maxn) / (maxn - 1); return num <= c; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("08.in", "r", stdin); // freopen("08.txt", "w", stdout); cin >> n; a.resize(n); for(int i = 0; i < n; ++i) cin >> a[i].f >> a[i].s; sort(a.begin(), a.end()); int now = res(a); ld t = T; while(t > minT){ // cout << t << endl; int l = rnd() % n; int r = rnd() % n; swap(a[l], a[r]); int nres = res(a); if(nres < now || !chance(pow(e, (nres - now) / t))) swap(a[l], a[r]); t *= eps; } cout << ans.size() << "\n"; for(auto v : ans) cout << v.f << " " << v.s << endl; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccjFkFYs.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccRQuLPv.o:vision.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccjFkFYs.o: in function `main':
grader.cpp:(.text.startup+0x1b3): undefined reference to `construct_network(int, int, int)'
collect2: error: ld returned 1 exit status