제출 #1170810

#제출 시각아이디문제언어결과실행 시간메모리
1170810SmuggingSpun조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2)C++20
1 / 100
1397 ms452 KiB
#include<bits/stdc++.h> #define taskname "B" using namespace std; typedef long long ll; int n, m; namespace sub1{ void solve(){ vector<ll>g(n, 0), _g; for(int _ = 0; _ < m; _++){ int u, v; cin >> u >> v; g[--u] |= 1LL << --v; _g = g; while(true){ bool flag = false; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(1LL << j & _g[i]){ for(int k = 0; k < n; k++){ if(k != i && k != j && (1LL << j & _g[k]) && (1LL << k & _g[j]) && ((_g[i] >> ll(k) & 1LL) == 0)){ _g[i] |= 1LL << k; flag = true; } } } } } if(!flag){ break; } } int ans = 0; for(int i = 0; i < n; i++){ ans += __builtin_popcountll(_g[i]); } cout << ans << "\n"; } } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } cin >> n >> m; if(n <= 50){ sub1::solve(); } }

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

joitter2.cpp: In function 'int main()':
joitter2.cpp:43:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...