結果
| 問題 | No.3723 Climb or Detour |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 18:18:07 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,904 bytes |
| 記録 | |
| コンパイル時間 | 2,623 ms |
| コンパイル使用メモリ | 359,972 KB |
| 実行使用メモリ | 9,928 KB |
| 最終ジャッジ日時 | 2026-09-19 18:18:14 |
| 合計ジャッジ時間 | 6,752 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 49 WA * 9 |
ソースコード
#include<bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define all(v) v.begin(),v.end()
using ll = long long;
using ull = unsigned long long;
using lll = __int128;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,ll>;
using vp=vector<pair<ll, ll>>;
using ld = long double;
//using mint=modint1000000007;
//using mint=modint998244353;
const ll INF=1ll<<60;
ll mod10=1e9+7;
ll mod99=998244353;
const double PI = acos(-1);
#define rep(i,n) for (ll i=0;i<n;++i)
#define per(i,n) for(ll i=(n)-1;i>=0;--i)
#define rep2(i,a,n) for (ll i=a;i<n;++i)
#define per2(i,a,n) for (ll i=a;i>=n;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
bool solve(){
ll N,K;cin>>N>>K;
ll si,sj;cin>>si>>sj;si--,sj--;
ll gi,gj;cin>>gi>>gj;gi--;gj--;
ll sum=abs(si-gi)+abs(sj-gj);
if(sum>K){
cout << -1 << endl;
return 0;
}
sum+=(abs(si-gi)+abs(sj-gj))/2*2;
if(sum<K){
cout << -1 << endl;
return 0;
}
if(abs(sum-K)%2){
cout << -1 << endl;
return 0;
}
vector<string> ans(N,string(N,'.'));
sum=abs(si-gi)+abs(sj-gj);
if(si>gi) swap(si,gi);
if(sj>gj) swap(sj,gj);
vll A,B;
for(int i=si+1;i<=gi;i+=2){
if(sum==K) break;
rep(j,N) ans[i][j]='#';
sum+=2;
A.push_back(i);
}
for(int j=sj+1;j<=gj;j+=2){
if(sum==K) break;
rep(i,N) ans[i][j]='#';
sum+=2;
B.push_back(j);
}
for(auto i:A) for(auto j:B) ans[i][j]='.';
ans[si][sj]=ans[gi][gj]='.';
rep(i,N) cout << ans[i] << endl;
return 0;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll T=1;//cin>>T;
rep(i,T) while(solve());
}