QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#320898 | #8217. King's Dinner | ucup-team1134# | AC ✓ | 1ms | 3676kb | C++23 | 3.8kb | 2024-02-03 23:29:22 | 2024-02-03 23:29:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int Q;cin>>Q;
while(Q--){
int N;cin>>N;
vector<string> S(N,string(N,'.'));
if(N==1){
cout<<".\n";
continue;
}else if(N==2){
cout<<"##\n";
cout<<"..\n";
continue;
}else if(N==3){
cout<<"##.\n";
cout<<"...\n";
cout<<"##.\n";
continue;
}else if(N%6==0){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(N-i<=3) continue;
if(N-j<=2) continue;
int a=i%6,b=j%6;
if(a==0||a==1||a==3||a==4){
if(b%2==0) S[i][j]='#';
}
}
}
for(int i=0;i<N-6;i+=2){
S[i][N-2]=S[i][N-1]='#';
}
for(int j=0;j<N-6;j+=3){
S[N-3][j]=S[N-3][j+1]=S[N-1][j]=S[N-1][j+1]='#';
}
vector<string> U={"#.#.##","#.#...","....##","##....","...#.#","##.#.#"};
for(int i=0;i<6;i++){
for(int j=0;j<6;j++){
S[N-6+i][N-6+j]=U[i][j];
}
}
}else if(N%6==1){
for(int i=0;i<N-1;i++){
for(int j=0;j<N;j++){
int a=i%6,b=j%6;
if(a==0||a==1||a==3||a==4){
if(b%2==0) S[i][j]='#';
}
}
}
for(int j=0;j<N-1;j+=3) S[N-1][j]=S[N-1][j+1]='#';
}else if(N%6==2){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(N-j<=2) continue;
int a=i%6,b=j%6;
if(a==0||a==1||a==3||a==4){
if(b%2==0) S[i][j]='#';
}
}
}
for(int i=0;i<N;i+=2) S[i][N-2]=S[i][N-1]='#';
}else if(N%6==3){
for(int i=0;i<N-3;i++){
for(int j=0;j<N;j++){
int a=i%6,b=j%6;
if(a==0||a==1||a==3||a==4){
if(b%2==0) S[i][j]='#';
}
}
}
for(int j=0;j<N-1;j+=3) S[N-3][j]=S[N-3][j+1]=S[N-1][j]=S[N-1][j+1]='#';
}else if(N%6==4){
for(int i=0;i<N-1;i++){
for(int j=0;j<N;j++){
if(N-j<=2) continue;
int a=i%6,b=j%6;
if(a==0||a==1||a==3||a==4){
if(b%2==0) S[i][j]='#';
}
}
}
for(int i=0;i<N-3;i+=2) S[i][N-2]=S[i][N-1]='#';
S[N-2][N-1]=S[N-1][N-1]='#';
for(int j=0;j<N-1;j+=3) S[N-1][j]=S[N-1][j+1]='#';
}else if(N%6==5){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
int a=i%6,b=j%6;
if(a==0||a==1||a==3||a==4){
if(b%2==0) S[i][j]='#';
}
}
}
}
for(int i=0;i<N;i++) cout<<S[i]<<"\n";
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3676kb
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:
ok all tests correct (50 test cases)
Test #3:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
39 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ................................................... #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...........................................
result:
ok all tests correct (39 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
11 90 91 92 93 94 95 96 97 98 99 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#... ........................................................................................## #.#.#.#.#.#.#.#.#.#.#.#.#.#...
result:
ok all tests correct (11 test cases)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
1 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#... .....................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed