| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 134728 | Dilshod_Imomov | Garage (IOI09_garage) | C++17 | 4 ms | 424 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second
# define pb push_back
# define pf push_front
# define For(i, a, b) for( int i = a; i < b; i++ )
# define in insert
# define all(a) a.begin(),a.end()
# define pi pair < int, int >
# define DEBUG
# define readfile(file) freopen ( (file + ".in").c_str(), "r", stdin)
# define writefile(file) freopen ( (file + ".out").c_str(), "w", stdout)
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
# define LARGE (1e7)
using namespace std;
void Set_File( string file ){readfile(file);writefile(file);}
int n, m;
queue < int > line;
int car;
ll money;
int main(){
/// Author: _Dilshod_
speed;
cin >> n >> m;
vector < pi > parking(n);
vector < pi > cars(m);
For ( i, 0, n ){
cin >> parking[i].fi;
}
For ( i, 0, m ){
cin >> cars[i].fi;
}
For ( i, 0, 2 * m ){
cin >> car;
if ( car < 0 ){
car *= -1;
parking[cars[car - 1].se].se = 0;
cars[car - 1].se = -1;
}
else {
line.push(car);
}
For ( j, 0, n ){
if ( !line.size() ) {
break;
}
if ( !parking[j].se )
{
parking[j].se = 1;
cars[line.front() - 1].se = j;
money += parking[j].fi * cars[line.front() - 1].fi;
line.pop();
}
}
}
cout << money;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
