Submission #44022590


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r)for(int i=(l);i<(r);i++)

int a[110][110][110];
int main(){
	int n;
	cin >> n;
	rep(i,0,n){
		int x1,y1,z1,x2,y2,z2;
		cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
		rep(x,x1,x2)rep(y,y1,y2)rep(z,z1,z2)a[x][y][z]=i+1;
	}
	
	vector<set<int>>ans(n+1);
	auto add=[&](int i,int j){
		ans[i].insert(j);
		ans[j].insert(i);
	};
	
	rep(x,0,100)rep(y,0,100)rep(z,0,100)if(a[x][y][z]){
		if(a[x+1][y][z]&&a[x+1][y][z]!=a[x][y][z])add(a[x][y][z],a[x+1][y][z]);
		if(a[x][y+1][z]&&a[x][y+1][z]!=a[x][y][z])add(a[x][y][z],a[x][y+1][z]);
		if(a[x][y][z+1]&&a[x][y][z+1]!=a[x][y][z])add(a[x][y][z],a[x][y][z+1]);
	}
	
	rep(i,1,n+1)cout << ans[i].size() << endl;
}

Submission Info

Submission Time
Task E - Tangency of Cuboids
User kyopro_friends
Language C++ (GCC 9.2.1)
Score 500
Code Size 739 Byte
Status AC
Exec Time 373 ms
Memory 43260 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
min.txt AC 12 ms 8248 KiB
random_01.txt AC 265 ms 23024 KiB
random_02.txt AC 266 ms 23084 KiB
random_03.txt AC 264 ms 23080 KiB
random_04.txt AC 373 ms 43076 KiB
random_05.txt AC 367 ms 43196 KiB
random_06.txt AC 368 ms 43260 KiB
random_07.txt AC 102 ms 15160 KiB
random_08.txt AC 97 ms 14712 KiB
random_09.txt AC 96 ms 14300 KiB
random_10.txt AC 264 ms 23644 KiB
random_11.txt AC 262 ms 23756 KiB
random_12.txt AC 263 ms 23532 KiB
random_13.txt AC 301 ms 35520 KiB
random_14.txt AC 302 ms 35600 KiB
random_15.txt AC 102 ms 17428 KiB
random_16.txt AC 190 ms 27004 KiB
random_17.txt AC 291 ms 32640 KiB
random_18.txt AC 271 ms 25224 KiB
random_19.txt AC 277 ms 25852 KiB
random_20.txt AC 278 ms 26556 KiB
random_21.txt AC 8 ms 3508 KiB
sample_01.txt AC 6 ms 3568 KiB
sample_02.txt AC 7 ms 3692 KiB
sample_03.txt AC 5 ms 3456 KiB