Submission #1293266


Source Code Expand

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int na, nb;

signed main() {
    cin >> na >> nb;
    set<int> sa, sb;
    rep(i,0,na) {
        int p; cin >> p;
        sa.insert(p);
    }
    rep(i,0,nb) {
        int p; cin >> p;
        sb.insert(p);
    }

    int cnt = 0;
    for(auto x : sa) {
        if(sb.count(x)) cnt++;
    }
    int cnt2 = sa.size() + sb.size() - cnt;
    double ans = 1.0 * cnt / cnt2;
    printf("%.12f\n", ans);
    return 0;
}

Submission Info

Submission Time
Task B - メタ構文変数
User tsutaj
Language C++14 (GCC 5.4.1)
Score 100
Code Size 2217 Byte
Status AC
Exec Time 157 ms
Memory 9600 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 40 / 40 30 / 30 30 / 30
Status
AC × 2
AC × 11
AC × 19
AC × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
Subtask1 sample_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt
Subtask2 sample_01.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt
Subtask3 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask3_01.txt, subtask3_02.txt, subtask3_03.txt, subtask3_04.txt, subtask3_05.txt, subtask3_06.txt, subtask3_07.txt, subtask3_08.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask1_01.txt AC 1 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 2 ms 256 KB
subtask1_04.txt AC 2 ms 384 KB
subtask1_05.txt AC 2 ms 256 KB
subtask1_06.txt AC 2 ms 384 KB
subtask1_07.txt AC 2 ms 256 KB
subtask1_08.txt AC 2 ms 384 KB
subtask1_09.txt AC 1 ms 256 KB
subtask1_10.txt AC 2 ms 384 KB
subtask2_01.txt AC 49 ms 4096 KB
subtask2_02.txt AC 133 ms 9600 KB
subtask2_03.txt AC 52 ms 4352 KB
subtask2_04.txt AC 133 ms 9600 KB
subtask2_05.txt AC 28 ms 2432 KB
subtask2_06.txt AC 62 ms 4992 KB
subtask2_07.txt AC 104 ms 7680 KB
subtask2_08.txt AC 130 ms 9600 KB
subtask3_01.txt AC 93 ms 6144 KB
subtask3_02.txt AC 157 ms 9600 KB
subtask3_03.txt AC 39 ms 2816 KB
subtask3_04.txt AC 154 ms 9600 KB
subtask3_05.txt AC 86 ms 5632 KB
subtask3_06.txt AC 154 ms 9600 KB
subtask3_07.txt AC 107 ms 6784 KB
subtask3_08.txt AC 155 ms 9600 KB