Submission #383896


Source Code Expand

#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define reE(i,a,b) for(auto (i)=(a);(i)<=(b);(i)++)
#define rE(i,b) reE(i,0,b)
#define reT(i,a,b) for(auto (i)=(a);(i)<(b);(i)++)
#define rT(i,b) reT(i,0,b)
#define rep(i,a,b) reE(i,a,b);
#define rev(i,a,b) for(auto (i)=(b)-1;(i)>=(a);(i)--)
#define fe(i,b) for (auto &(x):b);
#define itr(i,b) for(auto (i)=(b).begin();(i)!=(b).end();++(i))
#define rti(i,b) for(auto (i)=(b).rbegin();(i)!=(b).rend();++(i))
#define LL long long
#define all(b) (b).begin(),(b).end()

#define input_init stringstream ss; string strtoken, token; istringstream is
#define input_line  getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit)
#define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num

#define dir(xx,yy,x,y,i) (xx)=(x)+dir[(i)],(yy)=(y)+dir[(i)+1]

typedef complex<double> P;
typedef vector<P> Poly;

int adj[101][101];
LL res[101][101];
#define MOD 1000000007
int main(void){
	int N, a, b, x, y, M;
	cin >> N >> a >> b >> M;
	rT(i, M){
		cin >> x >> y;
		adj[x][y] = adj[y][x] = 1;
	}
	res[0][a] = 1;
	reE(c,1,101)
		reE(i,1,101)
		reE(j,1,101)
		if (adj[i][j])
			res[c][j] = (res[c - 1][i] + res[c][j]) % MOD;
		

	rT(i, 101){
		if (res[i][b]){
			cout << res[i][b] << endl;
			return 0;
		}
	}
	

	return(0);
}

Submission Info

Submission Time
Task C - 正直者の高橋くん
User btk15049
Language C++11 (GCC 4.9.2)
Score 100
Code Size 1664 Byte
Status AC
Exec Time 28 ms
Memory 932 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:56:15: warning: iteration 100u invokes undefined behavior [-Waggressive-loop-optimizations]
   if (adj[i][j])
               ^
./Main.cpp:21:20: note: containing loop
 #define reE(i,a,b) for(auto (i)=(a);(i)<=(b);(i)++)
                    ^
./Main.cpp:55:3: note: in expansion of macro ‘reE’
   reE(j,1,101)
   ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 32
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt, subtask1_21.txt, subtask1_22.txt, subtask1_23.txt, subtask1_24.txt, subtask1_25.txt, subtask1_26.txt, subtask1_27.txt, subtask1_28.txt, subtask1_29.txt, subtask1_30.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 25 ms 924 KB
subtask0_sample_02.txt AC 24 ms 812 KB
subtask1_01.txt AC 26 ms 800 KB
subtask1_02.txt AC 26 ms 932 KB
subtask1_03.txt AC 25 ms 932 KB
subtask1_04.txt AC 26 ms 924 KB
subtask1_05.txt AC 26 ms 924 KB
subtask1_06.txt AC 25 ms 924 KB
subtask1_07.txt AC 24 ms 808 KB
subtask1_08.txt AC 26 ms 800 KB
subtask1_09.txt AC 25 ms 800 KB
subtask1_10.txt AC 24 ms 924 KB
subtask1_11.txt AC 24 ms 804 KB
subtask1_12.txt AC 26 ms 924 KB
subtask1_13.txt AC 26 ms 804 KB
subtask1_14.txt AC 26 ms 796 KB
subtask1_15.txt AC 25 ms 932 KB
subtask1_16.txt AC 24 ms 808 KB
subtask1_17.txt AC 25 ms 800 KB
subtask1_18.txt AC 25 ms 800 KB
subtask1_19.txt AC 27 ms 800 KB
subtask1_20.txt AC 27 ms 800 KB
subtask1_21.txt AC 27 ms 804 KB
subtask1_22.txt AC 25 ms 804 KB
subtask1_23.txt AC 25 ms 804 KB
subtask1_24.txt AC 24 ms 808 KB
subtask1_25.txt AC 26 ms 808 KB
subtask1_26.txt AC 28 ms 880 KB
subtask1_27.txt AC 26 ms 924 KB
subtask1_28.txt AC 25 ms 924 KB
subtask1_29.txt AC 27 ms 796 KB
subtask1_30.txt AC 24 ms 924 KB