제출 #975341

#제출 시각아이디문제언어결과실행 시간메모리
975341IsamPaths (BOI18_paths)C++17
23 / 100
3088 ms8780 KiB
#include<bits/stdc++.h>
using namespace std;

#define eb emplace_back

constexpr int sz = 2e5 + 5;

int n, m, k, ans, c[sz], co;

vector<int> g[sz];

inline void dfs(int node){
	
	co |= (1<<c[node]);
	
	for(auto &to : g[node]){
		if(co & (1<<c[to])) continue;
		++ans;
		dfs(to);
	}
	
	co ^= (1<<c[node]);
	
	return;
}



signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	
	cin >> n >> m >> k;
	
	for(register int i = 1; i <= n; ++i){
		cin >> c[i];
		c[i]--;
	}
	
	for(register int i = 1, u, v; i <= m; ++i){
		cin >> u >> v;
		g[u].eb(v), g[v].eb(u);
	}
	
	for(register int i = 1; i <= n; ++i){
		dfs(i);
	}
	
	cout << ans << '\n';
	
	
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

paths.cpp: In function 'int main()':
paths.cpp:34:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   34 |  for(register int i = 1; i <= n; ++i){
      |                   ^
paths.cpp:39:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   39 |  for(register int i = 1, u, v; i <= m; ++i){
      |                   ^
paths.cpp:39:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   39 |  for(register int i = 1, u, v; i <= m; ++i){
      |                          ^
paths.cpp:39:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   39 |  for(register int i = 1, u, v; i <= m; ++i){
      |                             ^
paths.cpp:44:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   44 |  for(register int i = 1; i <= n; ++i){
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...