# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
209498 | Sho10 | 모임들 (IOI18_meetings) | C++14 | 30 ms | 2452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
ID: Sho10
LANG: C++
*/
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll a[100005],cnt[100005];
vector<ll>pos;
vector<ll>ans;
vector<ll> minimum_costs(vector<int>H,vector<int>L,vector<int>R){
ll n=H.size();
ll q=L.size();
for(ll i=0;i<H.size();i++)
a[i+1]=H[i];
for(ll i=1;i<=n;i++)
{
if(a[i]==2){
cnt[i]=cnt[i-1]+1;
pos.pb(i);
}else cnt[i]=cnt[i-1];
}
ll x=0;
while(x<q){
ll l=L[x],r=R[x];
l++;
r++;
if(cnt[r]-cnt[l-1]==0){
ans.pb(r-l+1);
goto End;
}else {
ll x=pos[cnt[l]-1],y=pos[cnt[r]-1];
ll sum=x-l+r-y+(l-r+1-x+l-r+y)*2;
ans.pb(sum);
goto End;
}
End:x++;
}
return ans;
}
컴파일 시 표준 에러 (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... |