# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1279146 | abyfu | Fancy Fence (CEOI20_fancyfence) | C++20 | 1100 ms | 46496 KiB |
//OwO
//#pragma GCC optimize("O3", "unroll-loops", "O2", "Ofast")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define namein "input.txt"
#define nameout "output.txt"
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define pb push_back
#define m_pi acos(-1)
using namespace std;
const ll inf = 1e18;
const int linf = 1.5e9;
void file(){
if (fopen(namein, "r")){
freopen(namein, "r", stdin);
freopen(nameout, "w", stdout);
}
}
const ll mod = 1e9 + 7;
const int N = 2e5 + 5, M = 5e5 + 5;
int n;
int h[N], w[N];
set<int> x;
ll sub3(){
ll u = *x.begin();
ll v = 0;
for (int i = 1; i <= n; i++) v += w[i];
cout << (v*(v + 1)/2 % mod)*(u*(u + 1)/2 % mod) % mod;
}
void run(){
cin >> n;
for (int i = 1; i <= n; i++){
cin >> h[i] >> w[i];
x.insert(h[i]);
}
if (x.size() == 1){
cout << sub3();
return;
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
file();
run();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |