# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890413 | 2023-12-21T06:33:22 Z | Muhammad_Aneeq | Sails (IOI07_sails) | C++17 | 1000 ms | 65536 KB |
/* بسم الله الرحمن الرحيم 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4952 KB | Output is correct |
2 | Correct | 1 ms | 4968 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 4956 KB | Output is correct |
2 | Correct | 9 ms | 4952 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 4956 KB | Output is correct |
2 | Correct | 155 ms | 4956 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 725 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 171 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 165 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1063 ms | 10188 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 526 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1053 ms | 11204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 214 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 205 ms | 65536 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |