結果
| 問題 | No.5025 Forest Fire |
| コンテスト | |
| ユーザー |
butsurizuki
|
| 提出日時 | 2026-10-22 20:28:25 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 2,000 ms |
| + 504µs | |
| コード長 | 1,096 bytes |
| 記録 | |
| コンパイル時間 | 2,799 ms |
| コンパイル使用メモリ | 354,524 KB |
| 実行使用メモリ | 9,924 KB |
| スコア | 149,774,446 |
| 最終ジャッジ日時 | 2026-10-24 14:46:48 |
| 合計ジャッジ時間 | 59,219 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / <nil> |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using pi=pair<int,int>;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,m;
cin >> n >> m;
vector<string> s(n);
for(auto &nx : s){cin >> nx;}
vector<vector<pi>> l1(2*n+5),l2(2*n+5);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
l1[i+j].push_back({i,j});
l2[i+n-j].push_back({i,j});
}
}
vector<pair<int,pi>> cand;
for(auto &nx : l1[40]){
cand.push_back({s[nx.first][nx.second],nx});
}
for(auto &nx : l2[40]){
cand.push_back({s[nx.first][nx.second],nx});
}
for(auto &nx : l1[60]){
cand.push_back({s[nx.first][nx.second],nx});
}
for(auto &nx : l2[60]){
cand.push_back({s[nx.first][nx.second],nx});
}
vector<pi> vp;
sort(cand.rbegin(),cand.rend());
for(auto &nx : cand){
if(vp.size()>=m){break;}
if(s[nx.second.first][nx.second.second]>'0'){
s[nx.second.first][nx.second.second]='0';
vp.push_back(nx.second);
}
}
cout << vp.size() << "\n";
for(auto &nx : vp){
cout << nx.first << " " << nx.second << "\n";
}
return 0;
}
butsurizuki