# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1158037 | Pacybwoah | Coin Collecting (JOI19_ho_t4) | C++20 | 34 ms | 9032 KiB |
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<pair<ll, ll>> vec(2 * n);
for(int i = 0; i < 2 * n; i++) cin >> vec[i].first >> vec[i].second;
vector<vector<ll>> grid(n + 1, vector<ll>(3));
ll ans = 0;
for(auto &[x, y]: vec){
int nx, ny;
if(x < 1){
nx = 1;
ans += 1 - x;
}
else if(x > n){
nx = n;
ans += x - n;
}
else nx = x;
if(y >= 2){
ans += y - 2;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |