# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
955698 | 2024-03-31T10:37:52 Z | vjudge1 | Pinball (JOI14_pinball) | C++17 | 4 ms | 432 KB |
#include <bits/stdc++.h> using namespace std; int m,n; vector<tuple<int,int,int,int> > v; int odg=-1; void proveri(string s) { int zavrsuva=-1; //cout<<endl<<endl<< "za "<<s<<endl; for (int i=1;i<=n;i++) { int p=i; //cout << "trga od "<<p<<endl; for (int j=0;j<m;j++) { int a=get<0>(v[j]),b=get<1>(v[j]),c=get<2>(v[j]),d=get<3>(v[j]); if (s[j]=='1' && a<=p && p<=b) { //cout<< "ulava u "<<a<<" "<<b<<endl; p=c; } } //cout << "zavrsuva kaj "<<p<<endl; if (zavrsuva==-1) zavrsuva=p; if (zavrsuva!=p) return; } int r=0; for (int i=0;i<s.size();i++) if (s[i]=='1') r+=get<3>(v[i]); if (odg==-1) odg=r; odg=min(odg,r); //cout<<s<<endl<<zavrsuva<<endl; //system("pause"); } void f(string s) { if (s.size()==v.size()) { proveri(s); return; } f(s+"0"); f(s+"1"); } int main() { cin>>m>>n; for (int i=0;i<m;i++) { int a,b,c,d; cin>>a>>b>>c>>d; v.push_back({a,b,c,d}); } f(""); cout<<odg<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 432 KB | Output is correct |
4 | Correct | 3 ms | 348 KB | Output is correct |
5 | Incorrect | 4 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 432 KB | Output is correct |
4 | Correct | 3 ms | 348 KB | Output is correct |
5 | Incorrect | 4 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 432 KB | Output is correct |
4 | Correct | 3 ms | 348 KB | Output is correct |
5 | Incorrect | 4 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 432 KB | Output is correct |
4 | Correct | 3 ms | 348 KB | Output is correct |
5 | Incorrect | 4 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |