Submission #1105711

#TimeUsernameProblemLanguageResultExecution timeMemory
1105711errorgornCutting a Rectangle (BOI24_rectangle)C++17
0 / 100
115 ms456 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define ii pair<int,int> #define iii tuple<int,int,int> #define fi first #define se second #define endl '\n' #define debug(x) cout << #x << ": " << x << endl #define pub push_back #define pob pop_back #define puf push_front #define pof pop_front #define lb lower_bound #define ub upper_bound #define rep(x,start,end) for(int x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--)) #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); int n; ii arr[100005]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin.exceptions(ios::badbit | ios::failbit); cin>>n; rep(x,1,n+1) cin>>arr[x].fi>>arr[x].se; int sum=0; rep(x,1,n+1) sum+=arr[x].fi*arr[x].se; vector<int> ans; rep(x,1,50000005) if (sum%x==0) if (x<=sum/x){ int a=x,b=sum/x; rep(x,n+1,1){ if (a<b) swap(a,b); if (arr[x].fi==a) b-=arr[x].se; else if (arr[x].se==b) a-=arr[x].fi; else if (arr[x].fi==b) a-=arr[x].se; else break; } if (a*b==0) ans.pub(x); } cout<<sz(ans)<<endl; for (auto it:ans) cout<<it<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...