QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#414260 | #4250. Mars | zeta7532 | 0 | 0ms | 0kb | C++17 | 1.9kb | 2024-05-18 18:45:28 | 2024-05-18 18:45:29 |
answer
#include "mars.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
struct unionfind{
unionfind() {}
vector<ll> par,sz;
unionfind(ll N):par(N),sz(N){
rep(i,N) par[i]=i,sz[i]=1;
}
ll root(ll x){
if(par[x]==x) return x;
ll t=root(par[x]);
par[x]=t;
return t;
}
void unite(ll x,ll y){
ll rx=root(x);
ll ry=root(y);
if(rx==ry) return;
if(sz[rx]>sz[ry]) swap(rx,ry);
par[rx]=ry;
sz[ry]+=sz[rx];
}
bool same(ll x,ll y){
ll rx=root(x);
ll ry=root(y);
return rx==ry;
}
ll size(ll x){
return sz[x];
}
};
std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
vector<vector<char>> A(2*k+3,vector<char>(2*k+3,'0'));
string ANS(100,'0');
for(ll x=i;x<=i+2;x++){
for(ll y=j;y<=j+2;y++){
rep(dx,2*k+1){
rep(dy,2*k+1){
if(x-i+dx>=2*k+3||y-j+dy>=2*k+3||dx*(2*k+1)+dy>=100){
cout << 10000 << endl;
return ANS;
}
A[x-i+dx][y-j+dy]=a[x][y][dx*(2*k+1)+dy];
}
}
}
}
return ANS;
if(k!=n-1){
rep(dx,2*k+3){
rep(dy,2*k+3){
ANS[dx*(2*k+3)+dy]=A[dx][dy];
}
}
return ANS;
}
rep(dx,2*k+3){
rep(dy,2*k+3){
ANS[dx*10+dy]=A[dx][dy];
}
}
unionfind tree(100);
rep(i,10){
rep(j,10){
if(i<10-1){
if(ANS[i*10+j]=='1'&&ANS[(i+1)*10+j]=='1'){
tree.unite(i*10+j,(i+1)*10+j);
}
}
if(j<10-1){
if(ANS[i*10+j]=='1'&&ANS[i*10+(j+1)]=='1'){
tree.unite(i*10+j,i*10+(j+1));
}
}
}
}
set<ll> s;
rep(i,10){
rep(j,10){
if(ANS[i*10+j]=='1'){
s.insert(tree.root(i*10+j));
}
}
}
ll ans=s.size();
rep(i,100) ANS[i]='0';
rep(i,20){
if(ans&(1<<i)) ANS[i]='1';
}
return ANS;
}
详细
Subtask #1:
score: 0
Instance #0 Runtime Error
Test #1:
score: 0
Instance #0 Runtime Error
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 2 934 389 626 424 1010111000011100001101110100011101000000010110011011101010001010000001011000010011000001111011111111 1101011000101100110110100011110010000010000100001010001110101111010000100001110000001110110011001010 0110111001011000110000110000011011100110001...
output:
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 -1
output:
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 -1
output:
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 -1
output:
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 -1
output:
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 -1
output:
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 -1
output:
input:
224bb858-b13b-5e97-cbba-4a10b0455e79 -1
output:
result:
Subtask #2:
score: 0
Skipped
Subtask #3:
score: 0
Skipped
Subtask #4:
score: 0
Skipped
Subtask #5:
score: 0
Skipped
Subtask #6:
score: 0
Skipped
Subtask #7:
score: 0
Skipped
Subtask #8:
score: 0
Skipped
Subtask #9:
score: 0
Skipped
Subtask #10:
score: 0
Skipped