| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 441182 | FEDIKUS | Garage (IOI09_garage) | C++17 | 2 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define xx first
#define yy second
#define srt(a) sort(a.begin(),a.end());
#define srtg(a,int) sort(a.begin(),a.end(),greater<int>())
#define lb(a,x) lower_bound(a.begin(),a.end(),x)
#define up(a,x) upper_bound(a.begin(),a.end(),x)
#define fnd(a,x) find(a.begin(),a.end(),x)
#define vstart auto startt=chrono::system_clock::now()
#define vend auto endd=chrono::system_clock::now()
#define vvreme chrono::duration<double> vremee=endd-startt
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef string str;
const int maxn=110;
const int maxm=2010;
int mul[maxn];
int tez[maxm];
bool mesto[maxm];
int gde[maxm];
void solve(){
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++) cin>>mul[i];
for(int i=1;i<=m;i++) cin>>tez[i];
int res=0;
queue<int> sled;
for(int i=0;i<2*m;i++){
int a;
cin>>a;
if(a>0){
sled.push(a);
}else{
a=abs(a);
mesto[gde[a]]=false;
}
if(!sled.empty())
for(int j=0;j<n;j++){
if(!mesto[j]){
gde[sled.front()]=j;
mesto[j]=true;
res+=mul[j]*tez[sled.front()];
sled.pop();
break;
}
}
}
cout<<res;
}
int main(){
ios;
int t=1;
//cin>>t;
while(t--) solve();
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
