結果

問題 No.3313 Matryoshka
コンテスト
ユーザー Cafe1942
提出日時 2025-10-15 15:48:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 73,944 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-24 11:50:30
合計ジャッジ時間 4,262 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int>L(N), R(N);
    for (int i = 0;i < N;i++) {
        cin >> L[i] >> R[i];
    }
    if(N > 2501){
    	cout<<-1;
    	return 0;
    }
    //愚直
    int ans = 0;
    for (int i = 0;i < N;i++) {
        for (int j = i + 1;j < N;j++) {
        	if(L[i] < L[j] < R[j] < R[i])ans++;
    	}
    }
    cout << ans;
    return 0;
}
0