| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1361133 | linda | Sails (IOI07_sails) | C++20 | 1097 ms | 2760 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
using pii=pair<int,int>;
const int maxn=100001;
signed main(){
int n;cin>>n;
vector<pii> a(n);
for(int i=0;i<n;i++){
cin>>a[i].first>>a[i].second;
}
sort(a.begin(),a.end());
vector<int> mon(maxn);
mon[0]=1000000;
for(int i=0;i<n;i++){
auto [x,y]=a[i];
int m=mon[x-y+1];
if(x==y||m!=mon[x-y]){
for(int j=0;j<y;j++){
mon[x-j]++;
}
}else{
int meg;
for(int j=0;j<y;j++){
if(mon[x-j]==m){
meg=j;break;
}
mon[x-j]++;
}
int p = x - y + 1;
while (p > 1 && mon[p - 1] == m) p--;
for(int j=0;j<y-meg;j++)mon[p+j]++;
}
}
int ans=0;
for(int i=0;i<10;i++){
ans+=(mon[i]*mon[i]-mon[i])/2;
}
cout<<ans<<'\n';
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
