結果
| 問題 | No.3657 Gathering Stones |
| コンテスト | |
| ユーザー |
rinrion
|
| 提出日時 | 2026-08-30 14:58:45 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,694 bytes |
| 記録 | |
| コンパイル時間 | 2,992 ms |
| コンパイル使用メモリ | 254,140 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 14:58:54 |
| 合計ジャッジ時間 | 5,386 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 WA * 14 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
#define rep(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define repr(i, s, n) for (int i = (s); i >= (int)(n); --i)
#define sz(x) ((int)(x).size())
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
auto _ = []{ios::sync_with_stdio(false); cin.tie(nullptr); return 0;}();
const int INFI = 1 << 30;
const ll INFL = 1LL << 62;
vvi rotate (vvi& grid, int times) {
int h = grid.size ();
int w = grid[0].size ();
vvi res=grid;
times %= 4;
rep (i, 0, times){
vvi rotatedGrid (w, vector<int> (h));
rep (j, 0, h){
rep (k, 0, w) rotatedGrid[k][h - j - 1] = res[j][k];
}
res = rotatedGrid;
swap (h, w);
}
return res;
}
int main() {
int h, w;
cin >> h >> w;
vvi a(h,vi(w,0));
rep (i, 0, h){
rep (j, 0, w){
char c;
cin >> c;
if(c=='#')a[i][j]=1;
}
}
vi hh(h,0);
vvi aa(h,vi(w,0));
rep (i, 0, h){
hh[i]=accumulate(a[i].begin(), a[i].end(), 0);
rep (j, 0, hh[i]){
aa[i][j]=1;
}
}
aa=rotate(aa,1);
vi ww(w,0);
vector<vector<char>>ans(h,vector<char>(w,'.'));
rep (i, 0, w){
ww[i]=accumulate(aa[i].begin(), aa[i].end(), 0);
}
rep (j, 0, w){
rep (i, 0, ww[j]){
ans[i][j]='#';
}
}
for (auto x: ans){
for (auto y: x){
cout << y;
}
cout << '\n';
}
return 0;
}
rinrion