提出 #70453332


ソースコード 拡げる

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

int main() {
  int i,j,k,n,ans;
  ans=0;
  
  cin >> n;
  vector<int> A(n);

  for (int i = 0; i < n; i++) {
    cin >> A.at(i);
  }


  for (int i = 0; i < n-2; i++) {
    for (int j = 1; j < n-i; j++) {
      for (int k = 1; k < n-i-j; k++) {
//        cout << A.at(i) << A.at(i+j) << A.at(i+j+k) << endl;
        if(A.at(i)==A.at(i+j)&&A.at(i+j)==A.at(i+j+k)&&A.at(i+j+k)==A.at(i)){
//          ans --;
        }
        else if(A.at(i)==A.at(i+j)||A.at(i+j)==A.at(i+j+k)||A.at(i+j+k)==A.at(i)){
          ans ++;
        }
//      cout << ans << endl;  
      }
    }
  }
  cout << ans << endl;
  
}

提出情報

提出日時
問題 C - Odd One Subsequence
ユーザ scentream
言語 C++ 20 (gcc 12.2)
得点 0
コード長 681 Byte
結果 TLE
実行時間 2210 ms
メモリ 4152 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:5:7: warning: unused variable ‘i’ [-Wunused-variable]
    5 |   int i,j,k,n,ans;
      |       ^
Main.cpp:5:9: warning: unused variable ‘j’ [-Wunused-variable]
    5 |   int i,j,k,n,ans;
      |         ^
Main.cpp:5:11: warning: unused variable ‘k’ [-Wunused-variable]
    5 |   int i,j,k,n,ans;
      |           ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 300
結果
AC × 2
AC × 4
TLE × 24
セット名 テストケース
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3480 KiB
example_01.txt AC 1 ms 3668 KiB
hand_00.txt TLE 2207 ms 3980 KiB
hand_01.txt TLE 2210 ms 4072 KiB
hand_02.txt TLE 2207 ms 4028 KiB
hand_03.txt AC 1 ms 3516 KiB
hand_04.txt AC 1 ms 3668 KiB
hand_05.txt TLE 2207 ms 4152 KiB
random_00.txt TLE 2207 ms 4120 KiB
random_01.txt TLE 2207 ms 4052 KiB
random_02.txt TLE 2207 ms 3996 KiB
random_03.txt TLE 2207 ms 4056 KiB
random_04.txt TLE 2207 ms 4012 KiB
random_05.txt TLE 2207 ms 4064 KiB
random_06.txt TLE 2207 ms 4060 KiB
random_07.txt TLE 2210 ms 4076 KiB
random_08.txt TLE 2207 ms 4148 KiB
random_09.txt TLE 2207 ms 4068 KiB
random_10.txt TLE 2207 ms 4052 KiB
random_11.txt TLE 2207 ms 3968 KiB
random_12.txt TLE 2207 ms 4152 KiB
random_13.txt TLE 2207 ms 4048 KiB
random_14.txt TLE 2207 ms 3968 KiB
random_15.txt TLE 2207 ms 4152 KiB
random_16.txt TLE 2207 ms 3996 KiB
random_17.txt TLE 2207 ms 4100 KiB
random_18.txt TLE 2207 ms 4072 KiB
random_19.txt TLE 2207 ms 4096 KiB