結果

問題 No.762 PDCAパス
ユーザー chocoruskchocorusk
提出日時 2018-12-10 00:06:57
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,060 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 96,180 KB
実行使用メモリ 7,648 KB
最終ジャッジ日時 2023-10-14 21:59:22
合計ジャッジ時間 5,609 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
6,412 KB
testcase_02 WA -
testcase_03 AC 4 ms
6,580 KB
testcase_04 AC 4 ms
6,416 KB
testcase_05 AC 4 ms
6,388 KB
testcase_06 WA -
testcase_07 AC 4 ms
6,500 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 3 ms
6,492 KB
testcase_14 AC 4 ms
6,432 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 4 ms
6,452 KB
testcase_18 WA -
testcase_19 AC 3 ms
6,392 KB
testcase_20 WA -
testcase_21 AC 3 ms
6,524 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
	ll ct[100000]={};
	int n, m;
	cin>>n>>m;
	string s;
	vector<int> g[100000];
	for(int i=0; i<m; i++){
		int u, v;
		cin>>u>>v;
		u--; v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for(int i=0; i<n; i++){
		if(s[i]=='P'){
			ct[i]=1;
			for(auto y:g[i]){
				if(s[y]=='D'){
					ct[y]++;
				}
			}
		}
	}
	for(int i=0; i<n; i++){
		if(s[i]=='D'){
			for(auto y:g[i]){
				if(s[y]=='C'){
					ct[y]+=ct[i];
				}
			}
		}
	}
	ll ans=0;
	for(int i=0; i<n; i++){
		if(s[i]=='C'){
			for(auto y:g[i]){
				if(s[y]=='A'){
					ct[y]+=ct[i];
				}
			}
		}
	}
	for(int i=0; i<n; i++){
		if(s[i]=='A') ans=(ans+ct[i])%MOD;
	}
	cout<<ans<<endl;
	return 0;
}
0