結果
| 問題 | No.1623 三角形の制作 | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2021-07-23 21:26:43 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 76 ms / 2,000 ms | 
| コード長 | 765 bytes | 
| コンパイル時間 | 3,892 ms | 
| コンパイル使用メモリ | 252,140 KB | 
| 最終ジャッジ日時 | 2025-01-23 07:47:13 | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 19 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |                 scanf("%d",&r[i]);
      |                 ~~~~~^~~~~~~~~~~~
main.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |                 scanf("%d",&g[i]);
      |                 ~~~~~^~~~~~~~~~~~
main.cpp:27:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |                 scanf("%d",&b[i]);
      |                 ~~~~~^~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
int main(){
	int n;
	cin>>n;
	
	vector<int> r(n),g(n),b(n);
	
	vector<long long> cr(3005,0),cg(3005,0),cb(3005,0);
	
	rep(i,n){
		scanf("%d",&r[i]);
		cr[r[i]]++;
	}
	rep(i,n){
		scanf("%d",&g[i]);
		cg[g[i]]++;
	}
	rep(i,n){
		scanf("%d",&b[i]);
		cb[b[i]]++;
	}
	
	long long ans = 0LL;
	
	vector<long long> cnt(6005,0);
	
	rep(i,3005){
		for(int j=0;j<i;j++){
			cnt[i+j] += cg[i] * cb[j];
			cnt[i+j] += cb[i] * cg[j];
		}
		cnt[i*2] += cg[i] * cb[i];
		for(int j=i+1;j<6005;j++){
			ans += cr[i] * cnt[j];
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}
            
            
            
        