結果
| 問題 |
No.2680 研究室配属
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-20 21:10:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| コード長 | 842 bytes |
| コンパイル時間 | 1,718 ms |
| コンパイル使用メモリ | 197,848 KB |
| 最終ジャッジ日時 | 2025-02-20 08:26:36 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> istream& operator >> (istream& is, vector<T>& vec) {
for(T& x : vec) is >> x;
return is;
}
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
if(vec.empty()) return os;
os << vec[0];
for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
return os;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int h, w, v;
cin >> h >> w;
vector<int> ans(h, -1), cnt(w);
vector<vector<int>> A(h, vector<int>(w));
cin >> cnt >> A;
for(int x = 0; x < w; x++){
for(int y = 0; y < h; y++){
if(ans[y] == -1 && cnt[A[y][x]] >= 1){
cnt[A[y][x]]--;
ans[y] = A[y][x];
}
}
}
cout << ans << '\n';
}