답안 #150902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
150902 2019-09-01T10:19:48 Z Alexa2001 함수컵 박물관 (FXCUP4_museum) C++17
100 / 100
91 ms 10360 KB
#include "museum.h"
#include <bits/stdc++.h>

using namespace std;

const int R = 101;
typedef long long ll;

int cnt[R*R*R+2];

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G)
{
    int n = B.size(), i, j;

    for(i=0; i<n; ++i)
    {
        for(j=1; j<(1<<3); ++j)
        {
            int bb, tt, gg;

            if(j & 1) bb = B[i];
                else bb = 0;

            if(j & 2) tt = T[i];
                else tt = 0;

            if(j & 4) gg = G[i];
                else gg = 0;

            int nr = (R * R * bb) + (R * tt) + gg;
            ++cnt[nr];
        }
    }

    ll ans = 0;

    for(i=1; i<=R*R*R; ++i)
    {
        int cntt = (i/R/R > 0) + (i / R % R > 0) + (i % R > 0);

        if(cntt & 1) ans += (ll) cnt[i] * cnt[i];
            else ans -= (ll) cnt[i] * cnt[i];
    }

    ans -= n;
    ans /= 2;

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 9 ms 376 KB Output is correct
4 Correct 9 ms 632 KB Output is correct
5 Correct 10 ms 1912 KB Output is correct
6 Correct 11 ms 2296 KB Output is correct
7 Correct 11 ms 3156 KB Output is correct
8 Correct 10 ms 504 KB Output is correct
9 Correct 11 ms 3960 KB Output is correct
10 Correct 11 ms 3960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 9 ms 376 KB Output is correct
3 Correct 9 ms 376 KB Output is correct
4 Correct 9 ms 632 KB Output is correct
5 Correct 10 ms 1912 KB Output is correct
6 Correct 11 ms 2296 KB Output is correct
7 Correct 11 ms 3156 KB Output is correct
8 Correct 10 ms 504 KB Output is correct
9 Correct 11 ms 3960 KB Output is correct
10 Correct 11 ms 3960 KB Output is correct
11 Correct 13 ms 4472 KB Output is correct
12 Correct 20 ms 1272 KB Output is correct
13 Correct 32 ms 5712 KB Output is correct
14 Correct 43 ms 7176 KB Output is correct
15 Correct 60 ms 8020 KB Output is correct
16 Correct 78 ms 6252 KB Output is correct
17 Correct 81 ms 6252 KB Output is correct
18 Correct 87 ms 7392 KB Output is correct
19 Correct 91 ms 10288 KB Output is correct
20 Correct 91 ms 10360 KB Output is correct