Submission #890413

#TimeUsernameProblemLanguageResultExecution timeMemory
890413Muhammad_AneeqSails (IOI07_sails)C++17
25 / 100
1063 ms65536 KiB
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #include <iostream> #include <vector> #include <set> using namespace std; #define int long long int const N=1e5+10; int n; int ans=1e15+10; int vis[N]={}; set<set<int>>d[N]; void dfs(int x,int val=0) { if (x==n) { ans=min(ans,val); return; } for (auto j:d[x]) { int z=0; for (auto k:j) { z+=vis[k]; vis[k]++; } dfs(x+1,val+z); for (auto k:j) vis[k]--; } } set<int>cur; void dfs1(int i,int h,int k) { if (cur.size()==k) { d[i].insert(cur); return; } for (int j=0;j<h;j++) { if (!vis[j]) { vis[j]=1; cur.insert(j); dfs1(i,h,k); vis[j]=0; cur.erase(j); } } } inline void solve() { cin>>n; for (int i=0;i<n;i++) { int h,k; cin>>h>>k; dfs1(i,h,k); } dfs(0); cout<<ans<<endl; } signed main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve(); }

Compilation message (stderr)

sails.cpp: In function 'void dfs1(long long int, long long int, long long int)':
sails.cpp:39:16: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   39 |  if (cur.size()==k)
      |      ~~~~~~~~~~^~~
#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...
#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...