Unfortunately we were unable to fully decode your file, as it is not encoded in UTF-8.
You can try to decode it yourself by downloading it here.
#include <iostream> #include <algorithm> using namespace std; int t; // ile przypadk�w long n, // 1 - 50 000 ile samochodow w; //wysokosc parkingu struct pojazd { long x2; long h; }; pojazd aa[50002], bb[50002]; long aanr[50002], bbnr[50002]; void wczytaniedanych(); //n, w, aa[], bb[] bool mazesnisaa(long p1, long p2) { if(aa[p1].x2 < aa[p2].x2) return true; else return false; } bool mazesnisbb(long p1, long p2) { if(bb[p1].x2 < bb[p2].x2) return true; else return false; } int main() { ios_base::sync_with_stdio(0); cin>>t; for(int it=0; it<t; it++) { wczytaniedanych(); for(long j=0; j<n; j++) { aanr[j]=j; bbnr[j]=j; } sort(aanr, aanr+n, mazesnisaa); sort(bbnr, bbnr+n, mazesnisbb); int ib; bool ok=true; for(int i=n-1; i>0; i--) { int a = aanr[i]; for(int j=i; j>=0; j--) if(bbnr[j]==a) {ib=j; break;} for(int j=ib; j<i; j++) { if(bb[bbnr[j]].h + bb[bbnr[j+1]].h <= w) { int tmp=bbnr[j]; bbnr[j]=bbnr[j+1]; bbnr[j+1]=tmp; } else {ok=false; break;} } if(!ok) break; } if(ok) cout<<"TAK"; else cout<<"NIE"; cout<<endl; } return 0; } void wczytaniedanych() { long x1, y1, x2,y2; cin>>n; cin>>w; for(int i=0; i<n; i++) { cin>>x1; cin>>y1; cin>>x2; cin>>y2; aa[i].x2=x2; aa[i].h=y2-y1; } for(int i=0; i<n; i++) { cin>>x1; cin>>y1; cin>>x2; cin>>y2; bb[i].x2=x2; bb[i].h=y2-y1; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #include <iostream> #include <algorithm> using namespace std; int t; // ile przypadk�w long n, // 1 - 50 000 ile samochodow w; //wysokosc parkingu struct pojazd { long x2; long h; }; pojazd aa[50002], bb[50002]; long aanr[50002], bbnr[50002]; void wczytaniedanych(); //n, w, aa[], bb[] bool mazesnisaa(long p1, long p2) { if(aa[p1].x2 < aa[p2].x2) return true; else return false; } bool mazesnisbb(long p1, long p2) { if(bb[p1].x2 < bb[p2].x2) return true; else return false; } int main() { ios_base::sync_with_stdio(0); cin>>t; for(int it=0; it<t; it++) { wczytaniedanych(); for(long j=0; j<n; j++) { aanr[j]=j; bbnr[j]=j; } sort(aanr, aanr+n, mazesnisaa); sort(bbnr, bbnr+n, mazesnisbb); int ib; bool ok=true; for(int i=n-1; i>0; i--) { int a = aanr[i]; for(int j=i; j>=0; j--) if(bbnr[j]==a) {ib=j; break;} for(int j=ib; j<i; j++) { if(bb[bbnr[j]].h + bb[bbnr[j+1]].h <= w) { int tmp=bbnr[j]; bbnr[j]=bbnr[j+1]; bbnr[j+1]=tmp; } else {ok=false; break;} } if(!ok) break; } if(ok) cout<<"TAK"; else cout<<"NIE"; cout<<endl; } return 0; } void wczytaniedanych() { long x1, y1, x2,y2; cin>>n; cin>>w; for(int i=0; i<n; i++) { cin>>x1; cin>>y1; cin>>x2; cin>>y2; aa[i].x2=x2; aa[i].h=y2-y1; } for(int i=0; i<n; i++) { cin>>x1; cin>>y1; cin>>x2; cin>>y2; bb[i].x2=x2; bb[i].h=y2-y1; } } |