提出 #76467116


ソースコード 拡げる

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <map>
#include <queue>
#include <unordered_set>
#include <cassert>
#include <list>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numbers>
#include <iostream>
#include <string>
#include <random>

using namespace std;

#define fori(n)for (ll i = 0; i < n; i++)
#define fo(n)for (int i = 0; i < n; i++)
#define fori1(n)for (ll i = 1; i < n + 1; i++)
#define revi1(n)for (int i = n; i >0; i--)
#define forj(n)for (ll j = 0; j < (n); j++)
#define rep(i, n)for (ll i = 0; i < (n); i++)
#define repj(i, j, n)for (ll i = j; i < (n); i++)
#define forj1(n)for (ll j = 1; j < n+1; j++)
#define revj1(n)for (ll j = n; j >=0; j--)
#define revi(n)for (int i = n-1; i >= 0; i--)
#define ll long long
#define ull unsigned ll
#define MAXN (2147483647)
#define MINN (-2147483648)
#define ffast_io ios::sync_with_stdio(false);\
                 cout.tie(nullptr); cin.tie(nullptr)

string svo(bool fl) {
    if (fl)
        return "YES";
    return "NO";
}

vector<vector<ll>> multi(vector<vector<ll>> a, vector<vector<ll>> b) {
    vector<vector<ll>> res(a.size(), vector<ll>(b[0].size(), 0));
    fori(a.size()) {
        forj(b[0].size()) {
            ll temp = 0;
            rep(k, b.size())temp = (temp + (a[i][k] * b[k][j]) % 1000000007l) % 1000000007;
            res[i][j] = temp;
        }
    }
    return res;
}

vector<vector<ll>> pow(const vector<vector<ll>> &mat, int powred) {
    if (powred == 1) return mat;
    if (powred % 2 == 1) return multi(pow(mat, powred - 1), mat);
    vector<vector<ll>> temp = pow(multi(mat, mat), powred / 2);
    return temp;
}

ll pow1(ll mat, ll powred) {
    if (powred == 1L) return mat;
    if ((powred % 2LL) == 1LL) return (pow1(mat, powred - 1LL) * mat) % 10LL;
    auto temp = pow1((mat * mat) % 10LL, powred / 2LL);
    return temp;
}

template<typename T>
void debug(const std::vector<T> &ttt, std::ostream &out = std::cout) {
    int temp = 1;
    for (auto it = ttt.begin(); it != ttt.end(); ++it, temp++) out << *it << ' ';
    out << std::endl;
}

template<typename T>
void debug(const std::vector<vector<T>> &ttt, std::ostream &out = std::cout) {
    for (int it = 0; it != ttt.size(); ++it) debug(ttt[it]);
}

template<typename T>
void debug(set<T> ttt, std::ostream &out = std::cout) {
    for (auto t: ttt) out << t << " ";
    out << endl;
}

void debug(bool k, std::ostream &out = std::cout) { if (k) out << "yes"; else out << "no"; }

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC b("sse,sse2,sse3,ssse3,sse4,abm,mmx,tune=native")



void solve(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    fori(n) {
        cin >> a[i];
    }
    fori(n) {
        cin >> b[i];
    }

    bool flag = true;

    fori(n) {
        if (b[a[i] - 1] != i + 1) {
            flag = false;
            break;
        }

    }

    if (flag) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }



}

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

提出情報

提出日時
問題 B - The Honest Woodcutters
ユーザ kashapoV
言語 C++23 (GCC 15.2.0)
得点 200
コード長 3313 Byte
結果 AC
実行時間 1 ms
メモリ 3636 KiB

コンパイルエラー

./Main.cpp:97: warning: ignoring '#pragma GCC b' [-Wunknown-pragmas]
   97 | #pragma GCC b("sse,sse2,sse3,ssse3,sse4,abm,mmx,tune=native")
./Main.cpp: In function 'std::vector<std::vector<long long int> > multi(std::vector<std::vector<long long int> >, std::vector<std::vector<long long int> >)':
./Main.cpp:26:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 | #define fori(n)for (ll i = 0; i < n; i++)
      |                                 ^
./Main.cpp:51:5: note: in expansion of macro 'fori'
   51 |     fori(a.size()) {
      |     ^~~~
./Main.cpp:30:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 | #define forj(n)for (ll j = 0; j < (n); j++)
      |                               ~~^~~~~
./Main.cpp:52:9: note: in expansion of macro 'forj'
   52 |         forj(b[0].size()) {
      |         ^~~~
./Main.cpp:31:35: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 | #define rep(i, n)for (ll i = 0; i < (n); i++)
      |                                   ^
./Main.cpp:54:13: note: in expansion of macro 'rep'
   54 |             rep(k, b.size())temp = (temp + (a[i][k] * b[k][j]) % 1000000007l) % 1000000007;
      |             ^~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 13
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_01.txt, 01_02.txt, 02_01.txt, 02_02.txt, 03_01.txt, 03_02.txt, 04_01.txt, 04_02.txt, 04_03.txt, 04_04.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 1 ms 3528 KiB
00_sample_02.txt AC 1 ms 3512 KiB
00_sample_03.txt AC 1 ms 3636 KiB
01_01.txt AC 1 ms 3528 KiB
01_02.txt AC 1 ms 3608 KiB
02_01.txt AC 1 ms 3508 KiB
02_02.txt AC 1 ms 3576 KiB
03_01.txt AC 1 ms 3452 KiB
03_02.txt AC 1 ms 3564 KiB
04_01.txt AC 1 ms 3584 KiB
04_02.txt AC 1 ms 3452 KiB
04_03.txt AC 1 ms 3608 KiB
04_04.txt AC 1 ms 3576 KiB