結果

問題 No.3648 Overbooked Meeting Rooms
コンテスト
ユーザー Guran08
提出日時 2026-08-28 21:48:17
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 436µs
コード長 1,860 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,023 ms
コンパイル使用メモリ 331,844 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-28 21:48:55
合計ジャッジ時間 3,806 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:39:12: warning: ignoring return value of 'constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   39 |         b[i];
      |            ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/vector:68,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/functional:66,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:55,
                 from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc@15/15.3.0/include/c++/15/bits/stl_vector.h:1261:7: note: declared here
 1261 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
// using mint = modint998244353;
//using mint = modint1000000007;
using ll = long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
template<typename T_>bool chmax(T_& a, const T_& b) { if (a < b) { a = b;return true; } else { return false; } }
template<typename T_>bool chmin(T_& a, const T_& b) { if (a > b) { a = b;return true; } else { return false; } }

#ifdef LOCAL
template<class T, class U> ostream& operator<<(ostream& o, const pair<T, U>& p) { return o << "(" << p.first << ", " << p.second << ")"; }
template<class... T> ostream& operator<<(ostream& o, const tuple<T...>& t) { o << "("; apply([&o](auto&&... a) { int c = 0; (((o << (c++ ? ", " : "") << a)), ...); }, t); return o << ")"; }
template<class V> auto operator<<(ostream& o, const V& v) -> std::enable_if_t<!std::is_same_v<V, std::string> && !std::is_same_v<V, std::string_view>, decltype(v.begin(), o)> { o << "{"; int c = 0; for (auto& x : v) o << (c++ ? ", " : "") << x; return o << "}"; }
#define dbg(...) cerr<<"["<<#__VA_ARGS__<<"]: ",([](auto&&... a){((cerr<<a<<' '),...);})(__VA_ARGS__),cerr<<'\n'
#else
#define dbg(...) void(0)
#endif

const int di[] = { -1,0,1,0 };
const int dj[] = { 0,-1,0,1 };
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;

void solve() {
    int n, m; cin >> n >> m;
    vector<int> a(n, 0), b(m, 0);
    int ans = 0;
    vector<int> c(m, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
        c[a[i]]++;
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        b[i];
        ans += max(0, c[i] - b[i]);
    }
    cout << ans << "\n";

}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}
0