Re: [gcj] Qualification Round 2018 Trouble Sort RunTime Error

2019-03-20 Thread Παυλος Τιριτιρης
thanks,i'm so tired i didn't realized that

Στις Τετ, 20 Μαρ 2019 στις 7:33 μ.μ., ο/η Luke Pebody 
έγραψε:

> You seem to be assuming all the integers are single digits.
>
> On Wed, 20 Mar 2019, 5:29 pm Παυλος Τιριτιρης 
>> Here is my code in C++ i tried a lot and i didn't find anything , i would
>> appreciate if someone finds where the error is.
>>
>>
>> #pragma GCC optimize "O3,inline"
>> #include 
>> #include 
>> #include 
>> #include 
>>
>> using namespace std;
>>
>>
>>
>> int checkSort(int *even,int *odd,int len){
>> int i=0;
>> while(i<(len-1)/2){
>> if(even[i]>odd[i]){
>> return 2*i;
>> }else if(odd[i]>even[i+1]){
>> return 2*i+1;
>> }
>> ++i;
>> }
>>
>> return -1;
>> }
>> int main() {
>> int N;
>> cin>>N;cin.ignore();
>> char *buff=(char *)malloc(50);
>> int *evenlist=(int *)malloc(4*20);
>> int *oddlist=(int *)malloc(4*20);
>> for(int i=0;i> int len,len0,len1;
>> cin>>len;cin.ignore();
>> len0=(len+1)/2;
>> len1=len/2;
>> cin.read(buff,len*2 - 1);cin.ignore();
>> for(int j=0;j> evenlist[j]=buff[4*j]-48;
>> oddlist[j]=buff[4*j + 2]-48;
>> }
>>
>> if(len%2==1){
>> evenlist[len0-1]=buff[4*(len0-1)]-48;
>> }
>> sort(evenlist,evenlist+len0);
>> sort(oddlist,oddlist+len1);
>> int check=checkSort(evenlist,oddlist,len);
>> if(check==-1){
>> cout<<"Case #"<> }else{
>> cout<<"Case #"<> }
>> }
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Code Jam" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-code+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-code@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-code/b8903bd2-756b-48e5-87e7-ad2bc7028a81%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/CAECKw-MwnADLcoGxL181z%2BqBTpga%3D%3DWGNWmXx3jUxMBC2uDFRA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAH8FoSPoDsuOdtN%3DuD9sNo_r75MEXnevoBNxRbwtPVNWnZ0dTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gcj] Qualification Round 2018 Trouble Sort RunTime Error

2019-03-20 Thread Luke Pebody
You seem to be assuming all the integers are single digits.

On Wed, 20 Mar 2019, 5:29 pm Παυλος Τιριτιρης  Here is my code in C++ i tried a lot and i didn't find anything , i would
> appreciate if someone finds where the error is.
>
>
> #pragma GCC optimize "O3,inline"
> #include 
> #include 
> #include 
> #include 
>
> using namespace std;
>
>
>
> int checkSort(int *even,int *odd,int len){
> int i=0;
> while(i<(len-1)/2){
> if(even[i]>odd[i]){
> return 2*i;
> }else if(odd[i]>even[i+1]){
> return 2*i+1;
> }
> ++i;
> }
>
> return -1;
> }
> int main() {
> int N;
> cin>>N;cin.ignore();
> char *buff=(char *)malloc(50);
> int *evenlist=(int *)malloc(4*20);
> int *oddlist=(int *)malloc(4*20);
> for(int i=0;i int len,len0,len1;
> cin>>len;cin.ignore();
> len0=(len+1)/2;
> len1=len/2;
> cin.read(buff,len*2 - 1);cin.ignore();
> for(int j=0;j evenlist[j]=buff[4*j]-48;
> oddlist[j]=buff[4*j + 2]-48;
> }
>
> if(len%2==1){
> evenlist[len0-1]=buff[4*(len0-1)]-48;
> }
> sort(evenlist,evenlist+len0);
> sort(oddlist,oddlist+len1);
> int check=checkSort(evenlist,oddlist,len);
> if(check==-1){
> cout<<"Case #"< }else{
> cout<<"Case #"< }
> }
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/b8903bd2-756b-48e5-87e7-ad2bc7028a81%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAECKw-MwnADLcoGxL181z%2BqBTpga%3D%3DWGNWmXx3jUxMBC2uDFRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gcj] Qualification Round 2018 Trouble Sort RunTime Error

2019-03-20 Thread Παυλος Τιριτιρης
Here is my code in C++ i tried a lot and i didn't find anything , i would 
appreciate if someone finds where the error is.


#pragma GCC optimize "O3,inline"
#include 
#include 
#include   
#include 

using namespace std;



int checkSort(int *even,int *odd,int len){
int i=0;
while(i<(len-1)/2){
if(even[i]>odd[i]){
return 2*i;
}else if(odd[i]>even[i+1]){
return 2*i+1;
}
++i;
}

return -1;
}
int main() {
int N;
cin>>N;cin.ignore(); 
char *buff=(char *)malloc(50);
int *evenlist=(int *)malloc(4*20);
int *oddlist=(int *)malloc(4*20);
for(int i=0;i>len;cin.ignore(); 
len0=(len+1)/2;
len1=len/2;
cin.read(buff,len*2 - 1);cin.ignore();
for(int j=0;jhttps://groups.google.com/d/msgid/google-code/b8903bd2-756b-48e5-87e7-ad2bc7028a81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.