Submission #447915

#TimeUsernameProblemLanguageResultExecution timeMemory
447915idasRailway (BOI17_railway)C++11
0 / 100
53 ms6012 KiB
#include <bits/stdc++.h> #define FOR(i, begin, end) for(int i = (begin); i < (end); i++) #define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr) #define F first #define S second #define PB push_back #define MP make_pair #define SZ(x) ((int)((x).size())) #define LE(vec) vec[vec.size()-1] #define TSTS int t; cin >> t; while(t--)solve() const int INF = 1e9; const long long LINF = 1e18; const long double PI = asin(1)*2; const int MOD = 1e9+7; using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef map<int, int> mii; typedef long long ll; typedef long double ld; void setIO() { FAST_IO; } void setIO (string s) { setIO(); freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } vector<pii> plan; map<pii, int> cnt; int main() { setIO(); int n, m, k; cin >> n >> m >> k; FOR(i, 0, n-1) { int a, b; cin >> a >> b; plan.PB({min(a, b), max(a, b)}); } FOR(i, 0, m) { int t; cin >> t; int a[t]; FOR(j, 0, t) { cin >> a[j]; } FOR(j, 0, t) { FOR(x, j+1, t) { cnt[{min(a[j], a[x]), max(a[j], a[x])}]++; } } } vi ans; for(auto it : cnt){ pii pr=it.F; int num=it.S; if(num>=k){ FOR(i, 0, n-1) if(plan[i].F==pr.F && plan[i].S==pr.S){ ans.PB(i+1); } } } cout << ans.size() << '\n'; for(auto x : ans){ cout << x << " "; } }

Compilation message (stderr)

railway.cpp: In function 'void setIO(std::string)':
railway.cpp:31:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |   freopen((s+".in").c_str(),"r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
railway.cpp:32:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |   freopen((s+".out").c_str(),"w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...