Submission #1083919

#TimeUsernameProblemLanguageResultExecution timeMemory
1083919raczekPortal (BOI24_portal)C++17
11 / 100
16 ms3672 KiB
#include<bits/stdc++.h> using namespace std; #ifdef DEBUG auto&operator <<(auto& o, pair<auto, auto> p) {return o<<"("<<p.first<<", "<<p.second<<")";} auto operator <<(auto& o, auto x)->decltype(x.end(), o) {o<<"{"; for(auto v : x) o<<v<<", "; return o<<"}";} #define debug(X) cout<<"["#X"]"<<X<<endl; #else #define debug(X) {} #endif #define int long long struct vec { int x, y; vec(int _x, int _y) { x = _x; y = _y; } vec getNorm() { vec nw(0, 0); nw.x = x/__gcd(x, y); nw.y = y/__gcd(x, y); return nw; } int getPts() { vec norm = getNorm(); int mx = x, my = y; if(norm.x == 0 && norm.y == 0) return 0; if(norm.x == 0) swap(norm.x, norm.y), swap(mx, my); return mx / norm.x; } bool operator ||(vec& obj) { if(obj.getNorm().x == this->getNorm().x && obj.getNorm().y == this->getNorm().y) return true; return false; } }; int operator *(vec& obj1, vec& obj2) { return obj1.x*obj2.y - obj1.y*obj2.x; } auto&operator <<(auto& o, vec V) {return o<<"["<<V.x<<";"<<V.y<<"]";} int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; int prevX, prevY; vector<vec> vfs; for(int i=0;i<n;i++) { int x, y; cin>>x>>y; if(i != 0) vfs.push_back(vec(x-prevX, y-prevY)); prevX = x; prevY = y; } if(n <= 2) {cout<<-1; return 0;} if(vfs[0] || vfs[1]) {cout<<-1; return 0;} debug(vfs); int B = vfs[0].getPts() + vfs[1].getPts() + 1; int P = abs(vfs[0]*vfs[1]); int W = P - B + 1; debug(B); debug(P); debug(W); cout<<W + B - 1; }

Compilation message (stderr)

Main.cpp:43:18: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   43 | auto&operator <<(auto& o, vec V) {return o<<"["<<V.x<<";"<<V.y<<"]";}
      |                  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...