結果
| 問題 | No.3596 Queen Score Attack 1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-24 21:35:48 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| + 322µs | |
| コード長 | 1,070 bytes |
| 記録 | |
| コンパイル時間 | 1,328 ms |
| コンパイル使用メモリ | 197,460 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-24 21:35:51 |
| 合計ジャッジ時間 | 3,032 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
ソースコード
#include <iostream>
#include <ranges>
#include <algorithm>
#include <vector>
using namespace std;
using ll=long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int ttt;
cin>>ttt;
while(ttt--){
int h,w;
cin>>h>>w;
vector<vector<ll>> a(h,vector<ll>(w));
for(int i=0;i<h;i++)for(int j=0;j<w;j++)cin>>a[i][j];
bool ok=false;
for(int i=0;i<h;i++){
vector<ll> vec=a[i];
ranges::sort(vec,greater{});
if(vec[0]+vec[1]>0)ok=true;
}
for(int i=0;i<w;i++){
vector<ll> vec(h);
for(int j=0;j<h;j++)vec[j]=a[j][i];
ranges::sort(vec,greater{});
if(vec[0]+vec[1]>0)ok=true;
}
for(int i=1;i<h+w-2;i++){
vector<ll> vec;
for(int j=0;j<h;j++){
if(0<=i-j&&i-j<w)vec.push_back(a[j][i-j]);
}
ranges::sort(vec,greater{});
if(vec[0]+vec[1]>0)ok=true;
}
for(int i=-h+2;i<w-1;i++){
vector<ll> vec;
for(int j=0;j<h;j++){
if(0<=i+j&&i+j<w)vec.push_back(a[j][i+j]);
}
ranges::sort(vec,greater{});
if(vec[0]+vec[1]>0)ok=true;
}
if(ok)cout<<"infinite"<<endl;
else cout<<"finite"<<endl;
}
}