QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#367584#7943. LIS on GridWhimsicalWA 0ms3624kbC++231.1kb2024-03-26 08:28:092024-03-26 08:28:10

Judging History

你现在查看的是最新测评结果

  • [2024-03-26 08:28:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-03-26 08:28:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	ll t;cin>>t;
	while(t--){
		ll n,m;cin>>n>>m;
		vi a(m);rep(i,0,m)cin>>a[i];

		ll l=0,r=n;
		while(l+1<r){
			ll mid=(l+r)/2;
			ll s=0;
			for(ll x:a){
				s+=max(0ll,x-mid);
			}
			if(s>mid*(n-mid))l=mid;
			else r=mid;
		}
		cout<<r<<"\n";

		char y[m][n];
		rep(i,0,m){
			rep(j,0,n){
				y[i][j]='.';
			}
		}
		vi c(r);
		rep(i,0,r)c[i]=n-r+i;
		rep(i,0,sz(c))cout<<c[i]<<" ";cout<<endl;
		rep(i,0,m){
			int z=min(r,(ll)a[i]);
			rep(j,0,z){
				y[i][c[j]]='#';
				a[i]--;
			}
			ll j=0;
			while(a[i]>0){
				if(c[j]==0||j>0&&y[i][c[j]-1]=='#'){
					j++;
				}else{
					c[j]--;
					y[i][c[j]]='#';
					a[i]--;
				}
			}
			
		}

		rep(i,0,n){
			rep(j,0,m)cout<<y[j][i];cout<<"\n";
		}
	}
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3624kb

input:

4
2 4
1 1 1 1
3 3
3 3 3
4 4
4 3 2 1
4 5
2 3 4 3 2

output:

1
1 
....
####
3
0 1 2 
###
###
###
2
2 3 
####
#...
###.
##..
2
2 3 
..###
.####
####.
###..

result:

wrong answer Token parameter [name=s] equals to "1", doesn't correspond to pattern "[.#]{4,4}" (test case 1)