Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long lli;
- typedef pair<int, int> pii;
- #define x first
- #define y second
- const int N = 1e5;
- const int MD = 2560;
- pii dot[N + 10];
- int main(){
- int nDot;
- scanf("%d", &nDot);
- for(int i = 1; i <= nDot; ++i){
- scanf("%d", &dot[i].x);
- }
- for(int i = 1; i <= nDot; ++i){
- scanf("%d", &dot[i].y);
- }
- int currR = 0;
- int currC = 0;
- int overlap = 0;
- int sum = 0;
- for(int i = 2; i <= nDot; ++i){
- int diffR = (dot[i].x - dot[i - 1].x) % MD;
- int diffC = (dot[i].y - dot[i - 1].y) % MD;
- int newR = ((lli)currR * diffC) % MD;
- int newC = ((lli)currC * diffR) % MD;
- int newSq = ((lli)diffR * diffC * (i - 1)) % MD;
- overlap = (overlap + newR + newC + newSq) % MD;
- sum = (sum + overlap) % MD;
- currR = (currR + (lli)diffR * (i - 1)) % MD;
- currC = (currC + (lli)diffC * (i - 1)) % MD;
- }
- cout << ((lli)nDot * (nDot - 1) / 2) % MD << '\n' << sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement