提出 #44114210
ソースコード 拡げる
//>>>Qiansui
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mem(x,y) memset(x, y, sizeof(x))
#define debug(x) cout << #x << " = " << x << '\n'
#define debug2(x,y) cout << #x << " = " << x << " " << #y << " = "<< y << '\n'
//#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
/*
*/
const int maxm = 1e2 + 5, inf = 0x3f3f3f3f, mod = 998244353;
int n, a[maxm][maxm][maxm];
void solve(){
cin >> n;
int x1, x2, y1, y2, z1, z2;
for(int c = 1; c <= n; ++ c){
cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
for(int i = x1; i < x2; ++ i){
for(int j = y1; j < y2; ++ j){
for(int k = z1; k < z2; ++ k){
a[i][j][k] = c;
}
}
}
}
vector<set<int>> ans(n + 1);
for(int i = 0; i < 100; ++ i){
for(int j = 0; j < 100; ++ j){
for(int k = 0; k < 100; ++ k){
if(a[i][j][k]){
if(a[i + 1][j][k] && a[i + 1][j][k] != a[i][j][k]){
ans[a[i][j][k]].insert(a[i + 1][j][k]);
ans[a[i + 1][j][k]].insert(a[i][j][k]);
}
if(a[i][j + 1][k] && a[i][j + 1][k] != a[i][j][k]){
ans[a[i][j][k]].insert(a[i][j + 1][k]);
ans[a[i][j + 1][k]].insert(a[i][j][k]);
}
if(a[i][j][k + 1] && a[i][j][k + 1] != a[i][j][k]){
ans[a[i][j][k]].insert(a[i][j][k + 1]);
ans[a[i][j][k + 1]].insert(a[i][j][k]);
}
}
}
}
}
for(int i = 1; i <= n; ++ i) cout << ans[i].size() << '\n';
return ;
}
signed main(){
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int _ = 1;
// cin >> _;
while(_ --){
solve();
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | E - Tangency of Cuboids |
| ユーザ | qiansui |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 500 |
| コード長 | 2091 Byte |
| 結果 | AC |
| 実行時間 | 206 ms |
| メモリ | 42912 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 500 / 500 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| min.txt | AC | 12 ms | 7780 KiB |
| random_01.txt | AC | 91 ms | 22860 KiB |
| random_02.txt | AC | 91 ms | 22896 KiB |
| random_03.txt | AC | 92 ms | 22872 KiB |
| random_04.txt | AC | 204 ms | 42912 KiB |
| random_05.txt | AC | 206 ms | 42900 KiB |
| random_06.txt | AC | 198 ms | 42620 KiB |
| random_07.txt | AC | 57 ms | 14896 KiB |
| random_08.txt | AC | 54 ms | 14380 KiB |
| random_09.txt | AC | 53 ms | 14164 KiB |
| random_10.txt | AC | 96 ms | 23460 KiB |
| random_11.txt | AC | 98 ms | 23064 KiB |
| random_12.txt | AC | 99 ms | 23348 KiB |
| random_13.txt | AC | 144 ms | 35564 KiB |
| random_14.txt | AC | 148 ms | 35512 KiB |
| random_15.txt | AC | 53 ms | 16916 KiB |
| random_16.txt | AC | 95 ms | 26624 KiB |
| random_17.txt | AC | 118 ms | 32260 KiB |
| random_18.txt | AC | 104 ms | 24940 KiB |
| random_19.txt | AC | 109 ms | 25504 KiB |
| random_20.txt | AC | 113 ms | 26044 KiB |
| random_21.txt | AC | 5 ms | 3488 KiB |
| sample_01.txt | AC | 7 ms | 3424 KiB |
| sample_02.txt | AC | 5 ms | 3580 KiB |
| sample_03.txt | AC | 5 ms | 3576 KiB |