QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188201 | #6643. Graphs and Colors | qzzyq | WA | 1ms | 3892kb | C++14 | 1.5kb | 2023-09-25 16:38:10 | 2023-09-25 16:38:10 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define maxn
#define put() putchar('\n')
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
using namespace std;
void read(int &x){
int f=1;x=0;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
x*=f;
}
namespace Debug{
Tp void _debug(char* f,Ty t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,Ty x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
Tp ostream& operator<<(ostream& os,vector<Ty>& V){os<<"[";for(auto& vv:V) os<<vv<<",";os<<"]";return os;}
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
}using namespace Debug;
#define fi first
#define se second
#define mk make_pair
const int mod=1e9+7;
int power(int x,int y=mod-2) {
int sum=1;
while (y) {
if (y&1) sum=sum*x%mod;
x=x*x%mod;y>>=1;
}
return sum;
}
int n,m,k,a[105][105];
void solve(void) {
int i,j;
read(n);read(k);
if (k>n/2) return puts("NO"),void();
puts("YES");
for (i=1;i<=k;i++) a[2*i-1][2*i]=i;
for (i=1;i<=k;i++)
for (j=i+1;j<=k;j++)
a[2*i-1][2*j-1]=i,a[2*i][2*j]=i;
for (i=1;i<=k;i++)
for (j=i+1;j<=k;j++)
a[2*i-1][2*j]=j,a[2*i][2*j-1]=j;
for (i=2*k+1;i<=n;i++) {
for (j=1;j<=2*k;j++) a[j][i]=(j+1)/2;
}
for (i=2;i<=n;i++,put()) for (j=1;j<i;j++) printf("%d ",a[j][i]);
}
signed main(void){
// freopen("1.in","r",stdin);
int T;
read(T);
while (T--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3892kb
input:
768 8 24 7 20 17 61 17 76 16 100 16 16 15 59 9 17 14 31 14 61 10 32 17 55 5 7 10 29 14 82 13 47 17 32 5 10 16 76 14 59 8 28 13 19 12 41 13 41 11 32 11 53 3 2 16 52 16 87 7 12 9 15 15 65 15 53 17 47 6 15 12 1 14 35 16 60 12 31 14 70 15 88 12 2 8 23 12 38 16 111 16 117 5 4 14 90 12 55 15 41 15 48 15 4...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 1 1 1 1 1 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 NO NO NO NO NO YES 1 1 2 2 1 2 1 1 2 2 1 1 2...
result:
wrong answer Integer parameter [name=col] equals to 0, violates the range [1, 1] (test case 36)