이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |