提出 #30035136


ソースコード 拡げる

// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint998244353;
// using mint = modint1000000007;
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,k,n) for (int i = (k); i < (n); ++i)
using namespace std;
using ll = long long;
// using P = pair<ll,ll>;
using P = pair<int,int>;
using vint = vector<int>;
using vll = vector<ll>;
using vvint = vector<vector<int>>;
using vvll = vector<vector<ll>>;

// const ll INF = (ll)2e18+9;
const int INF = (int)2e9+7;
// const ll MOD = (ll)1e9+9;
template<typename T>
void chmin(T &a, T b) { a = min(a, b); }
template<typename T>
void chmax(T &a, T b) { a = max(a, b); }

template<typename T>
void print(vector<T> v) {
    int n = v.size();
    rep(i,n) {
        if (i == 0) cout << v[i];
        else cout << ' ' << v[i];
    }
    cout << endl;
}

void solve() {
    int n;
    cin >> n;
    vint A(n), B(n);
    rep(i,n) cin >> A[i];
    rep(i,n) cin >> B[i];

    int samepos = 0;
    rep(i,n) samepos += A[i] == B[i];

    int diffpos = 0;
    rep(i,n) rep(j,n) {
        if (i == j) continue;
        diffpos += A[i] == B[j];
    }

    cout << samepos << endl;
    cout << diffpos << endl;
}

int main() {
    solve();
    return 0;
}

提出情報

提出日時
問題 B - Hit and Blow
ユーザ goropikari
言語 C++ (GCC 9.2.1)
得点 200
コード長 1380 Byte
結果 AC
実行時間 9 ms
メモリ 3636 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 11
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 02_same_00.txt, 03_shuffle_00.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 6 ms 3436 KiB
00_sample_01.txt AC 2 ms 3592 KiB
00_sample_02.txt AC 2 ms 3468 KiB
01_random_00.txt AC 5 ms 3580 KiB
01_random_01.txt AC 9 ms 3500 KiB
01_random_02.txt AC 4 ms 3632 KiB
01_random_03.txt AC 4 ms 3500 KiB
01_random_04.txt AC 6 ms 3636 KiB
01_random_05.txt AC 5 ms 3632 KiB
02_same_00.txt AC 7 ms 3604 KiB
03_shuffle_00.txt AC 4 ms 3416 KiB