제출 #733907

#제출 시각아이디문제언어결과실행 시간메모리
733907vjudge1Garage (IOI09_garage)C++17
40 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define ff first #define ss second #define pb push_back #define ub upper_bound #define lb lower_bound #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); const int max6 = 2e6 + 1; const int max5 = 2e5 + 1; const int max9 = 1e9 + 1; const int mod = 1e9 + 7; const long long infinity = 1e15 + 7; vector<int> order; vector<int> wait; int n, m, income; int cost[101], w[2001], gar[2001], av[2001]; void into(int a) { int j; for (j = 1; j <= n; j++) if (av[j] == 0) { gar[a] = j; av[j] = 1; income += cost[j] * w[a]; return; } wait.pb(a); } int32_t main() { fastio; cin >> n >> m; for (int i = 1; i <= n; i++) cin >> cost[i]; for (int i = 1; i <= m; i++) cin >> w[i]; for (int i = 0; i < 2 * m; i++) { int a; cin >> a; if (a > 0) { into(a); } else { a = abs(a); if (gar[a] == 0) { for (int j = 0; j < wait.size(); j++) if (wait[j] == a) { wait.erase(wait.begin() + j); break; } } else { av[gar[a]] = 0; if (wait.size() > 0) into(a); } } } cout << income; }

컴파일 시 표준 에러 (stderr) 메시지

garage.cpp: In function 'int32_t main()':
garage.cpp:55:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for (int j = 0; j < wait.size(); j++)
      |                     ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...