QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#320816 | #8217. King's Dinner | ucup-team1631# | WA | 2ms | 3852kb | C++20 | 3.3kb | 2024-02-03 21:52:11 | 2024-02-03 21:52:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vvvvb = vector<vvvb>;
using vvvvvb = vector<vvvvb>;
#define all(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
template<class T>
bool chmax(T& p, T q, bool C = 1) {
if (C == 0 && p == q) {
return 1;
}
if (p < q) {
p = q;
return 1;
}
else {
return 0;
}
}
template<class T>
bool chmin(T& p, T q, bool C = 1) {
if (C == 0 && p == q) {
return 1;
}
if (p > q) {
p = q;
return 1;
}
else {
return 0;
}
}
ll modPow(long long a, long long n, long long p) {
if (n == 0) return 1; // 0乗にも対応する場合
if (n == 1) return a % p;
if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
long long t = modPow(a, n / 2, p);
return (t * t) % p;
}
ll cnt = 0;
ll gcd(ll(a), ll(b)) {
cnt++;
if (a == 0)return b;
if (b == 0)return a;
ll c = a;
while (a % b != 0) {
c = a % b;
a = b;
b = c;
}
return b;
}
ll sqrtz(ll N) {
ll L = 0;
ll R = sqrt(N) + 10000;
while (abs(R - L) > 1) {
ll mid = (R + L) / 2;
if (mid * mid <= N)L = mid;
else R = mid;
}
return L;
}
bool DEB=0;
void solve(ll N){
vvll A(N,vll(N,0));
if(DEB)cout<<N<<endl;
if(N%6==0){
rep(i,N/3-1){
rep(j,N/2){
A[i*3][j*2]=A[i*3+1][j*2]=1;
}
}
rep(j,N/3){
A[N-1][j*3]=A[N-1][j*3+1]=1;
if(N>=3)A[N-3][j*3]=A[N-3][j*3+1]=1;
}
}
else if(N%6==1){
rep(i,N/3){
rep(j,N/2+1){
A[i*3][j*2]=A[i*3+1][j*2]=1;
}
}
rep(j,N/3){
A[N-1][j*3]=A[N-1][j*3+1]=1;
}
}
else if(N%6==2){
rep(i,N/3+1){
rep(j,N/2-1){
A[i*3][j*2]=A[i*3+1][j*2]=1;
}
}
rep(i,N/2){
A[i*2][N-1]=A[i*2][N-2]=1;
}
}
else if(N%6==3){
rep(i,N/3-1){
rep(j,N/2+1){
A[i*3][j*2]=A[i*3+1][j*2]=1;
}
}
rep(j,N/3){
A[N-1][j*3]=A[N-1][j*3+1]=1;
A[N-3][j*3]=A[N-3][j*3+1]=1;
}
}
else if(N%6==4){
rep(i,N/3){
rep(j,N/2-1){
A[i*3][j*2]=A[i*3+1][j*2]=1;
}
}
rep(i,N/2-1){
A[i*2][N-2]=A[i*2][N-1]=1;
}
rep(j,N/3){
A[N-1][j*3]=A[N-1][j*3+1]=1;
}
A[N-1][N-1]=A[N-2][N-1]=1;
}
else if(N%6==5){
rep(i,N/3+1){
rep(j,N/2+1){
A[i*3][j*2]=A[i*3+1][j*2]=1;
}
}
}
rep(i,N){
rep(j,N)cout<<(A[i][j]==0?'.':'#');
cout<<endl;
}
if(DEB)cout<<endl;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll T;
cin>>T;
rep(t,T){
ll N;
cin>>N;
solve(N);
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3852kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3724kb
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 = 8, pans = 7 (test case 6)