提出 #58433322


ソースコード 拡げる

//yukicoder@cpp17

#include <iostream>
#include <iomanip>

#include <algorithm>

#include <cmath>
#include <cctype>
#include <climits>
#include <cassert>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>

#include <random>

#include <bitset>

#include <complex>

#include <utility>

#include <numeric>

#include <functional>


using namespace std;
using ll = long long;
using P = pair<ll,ll>;


const ll MOD = 998244353;
const ll MODx = 1000000007;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62LL)-1;
const double EPS = (1e-10);


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};


template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }
 
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/

/* comment outed because can cause bugs
__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
*/
int main(){
  string s,t;cin>>s>>t;
  if(s == t)cout << 0 << endl;
  else {
    for(int i = 0; min(s.size(), t.size()) > i; i++){
      if(s[i] != t[i]){
        cout << i+1 << endl;
        return 0;
      }
    }
    cout << min(s.size(), t.size())+1 << endl;
  }
  return 0;
}

提出情報

提出日時
問題 B - Unvarnished Report
ユーザ CleyL
言語 C++ 20 (gcc 12.2)
得点 200
コード長 1767 Byte
結果 AC
実行時間 1 ms
メモリ 3656 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:72:44: warning: comparison of integer expressions of different signedness: ‘const long unsigned int’ and ‘int’ [-Wsign-compare]
   72 |     for(int i = 0; min(s.size(), t.size()) > i; i++){
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~^~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 25
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.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
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3452 KiB
example_01.txt AC 1 ms 3496 KiB
example_02.txt AC 1 ms 3484 KiB
hand_00.txt AC 1 ms 3500 KiB
hand_01.txt AC 1 ms 3656 KiB
hand_02.txt AC 1 ms 3500 KiB
hand_03.txt AC 1 ms 3568 KiB
hand_04.txt AC 1 ms 3500 KiB
hand_05.txt AC 1 ms 3364 KiB
hand_06.txt AC 1 ms 3364 KiB
random_00.txt AC 1 ms 3464 KiB
random_01.txt AC 1 ms 3436 KiB
random_02.txt AC 1 ms 3524 KiB
random_03.txt AC 1 ms 3468 KiB
random_04.txt AC 1 ms 3460 KiB
random_05.txt AC 1 ms 3504 KiB
random_06.txt AC 1 ms 3500 KiB
random_07.txt AC 1 ms 3368 KiB
random_08.txt AC 1 ms 3484 KiB
random_09.txt AC 1 ms 3500 KiB
random_10.txt AC 1 ms 3488 KiB
random_11.txt AC 1 ms 3648 KiB
random_12.txt AC 1 ms 3460 KiB
random_13.txt AC 1 ms 3468 KiB
random_14.txt AC 1 ms 3524 KiB