結果

問題 No.1788 Same Set
ユーザー tute7627
提出日時 2021-11-14 10:45:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 412 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 198,480 KB
最終ジャッジ日時 2025-01-25 17:51:03
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 TLE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int>a(n), b(n);
  for(int i = 0; i < n; i++)cin >> a[i];
  for(int i = 0; i < n; i++)cin >> b[i];
  long long ans = 0;
  for(int i = 0; i < n; i++){
    set<int>sa, sb;
    for(int j = i; j < n; j++){
      sa.insert(a[j]);
      sb.insert(b[j]);
      if(sa == sb){
        ans++;
      }
    }
  }
  cout << ans << endl;
}
0