結果
| 問題 |
No.223 1マス指定の魔方陣
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2024-11-06 23:23:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,287 bytes |
| コンパイル時間 | 4,397 ms |
| コンパイル使用メモリ | 254,732 KB |
| 最終ジャッジ日時 | 2025-02-25 02:29:34 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 4 WA * 42 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:56:16: warning: ‘ii’ may be used uninitialized [-Wmaybe-uninitialized]
56 | while(x!=ii){
| ~^~~~
main.cpp:48:13: note: ‘ii’ was declared here
48 | int ii,jj;
| ^~
main.cpp:61:16: warning: ‘jj’ may be used uninitialized [-Wmaybe-uninitialized]
61 | while(y!=jj){
| ~^~~~
main.cpp:48:16: note: ‘jj’ was declared here
48 | int ii,jj;
| ^~
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001
int main(){
vector<vector<int>> a = {{6,12,7,9},{15,1,14,4},{10,8,11,5},{3,13,2,16}};
int n;
cin>>n;
if(n>=8){
rep(i,4){
rep(j,4)a[i].push_back(a[i][j]);
}
rep(i,4)a.push_back(a[i]);
rep(i,8){
rep(j,8){
int x = i/4,y = j/4;
if(x&&y)a[i][j] += 48;
else if(x)a[i][j] += 16;
else if(y)a[i][j] += 32;
}
}
}
if(n>=16){
rep(i,8){
rep(j,8)a[i].push_back(a[i][j]);
}
rep(i,8)a.push_back(a[i]);
rep(i,16){
rep(j,16){
int x = i/8,y = j/8;
if(x&&y)a[i][j] += 96;
else if(x)a[i][j] += 32;
else if(y)a[i][j] += 64;
}
}
}
int x,y,z;
cin>>x>>y>>z;
x--,y--;
int ii,jj;
rep(i,a.size()){
rep(j,a.size()){
if(a[i][j]==z){
ii = i,jj = j;
}
}
}
while(x!=ii){
a.insert(a.begin(),a.back());
a.pop_back();
ii = (ii+1)%n;
}
while(y!=jj){
rep(i,a.size()){
a[i].insert(a[i].begin(),a[i].back());
a[i].pop_back();
}
jj = (jj+1)%n;
}
rep(i,n){
rep(j,n){
if(j)printf(" ");
printf("%d",a[i][j]);
}
printf("\n");
}
return 0;
}
沙耶花