QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#463466 | #8217. King's Dinner | wdnmdwrnmmp | WA | 1ms | 3876kb | C++14 | 1.7kb | 2024-07-04 21:20:24 | 2024-07-04 21:20:25 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef vector<int> vi;
typedef pair<int,int> pi;
vector< vector<string> > sq(7);
void init(){
sq[1]={
"."
};
sq[2]={
"##",
".."
};
sq[3]={
"##.",
"...",
"##."
};
sq[4]={
"##.#",
"...#",
"#...",
"#.##"
};
sq[5]={
"##.##",
".....",
"##.##",
".....",
"##.##"
};
sq[6]={
"##.#.#",
"...#.#",
"##....",
"....##",
"#.#...",
"#.#.##"
};
}
void solve(){
int n; cin>>n;
vector<vector<bool>> ans(n, vector<bool>(n));
auto write0=[&](int x,int y){
rep(i,0,5){
rep(j,0,5){
ans[x+i][y+j]=(j%3<=1 && i%2==0);
}
}
};
auto write1=[&](int x,int y,int a,int b){
if(a==b){
rep(i,0,a-1){
rep(j,0,b-1){
ans[x+i][y+j]=(sq[a][i][j]=='#');
}
}
}
else{
if(a==6){
rep(i,0,a-1){
rep(j,0,b-1){
ans[x+i][y+j]=(i%3<=1 && j%2==0);
}
}
}
if(b==6){
rep(i,0,a-1){
rep(j,0,b-1){
ans[x+i][y+j]=(j%3<=1 && i%2==0);
}
}
}
}
};
rep(i,1,n/6){
rep(j,1,n/6){
write0((i-1)*6, (j-1)*6);
}
}
rep(i,1,n/6){
write1((i-1)*6, n/6*6, 6, n%6);
write1(n/6*6, (i-1)*6, n%6, 6);
}
int r=(n-1)%6+1;
write1(n-r, n-r, r, r);
rep(i,0,n-1){
rep(j,0,n-1){
cout<<(ans[i][j]? "#": ".");
}
cout<<'\n';
}
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
init();
int t; cin>>t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3876kb
input:
50 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
output:
. ## .. ##. ... ##. ##.# ...# #... #.## ##.## ..... ##.## ..... ##.## ##.#.# ...#.# ##.... ....## #.#... #.#.## ##.##.# ......# ##.##.. ......# ##.##.# ....... ##.##.. ##.##.#. ......#. ##.##... ......#. ##.##.#. ........ ##.##.## ........ ##.##.#.# ......#.# ##.##.... ......#.# ##.##.#.# ......... ...
result:
wrong answer jury has the better answer: jans = 13, pans = 11 (test case 8)