Page 29 of 43
Posted: Sat May 06, 2006 11:32 am
by iostream
i've found the problem with my code.
i've used this sample output:
Code: Select all
19
move 1 onto 0
move 0 onto 1
move 0 onto 2
move 2 onto 1
move 4 over 5
move 7 onto 8
move 9 onto 7
move 7 over 9
move 9 over 7
move 11 over 10
move 12 over 10
move 13 over 10
move 14 over 10
move 16 over 15
move 17 over 15
move 18 over 15
move 16 onto 14
pile 17 onto 12
move 15 over 10
pile 17 onto 14
pile 15 over 7
pile 6 over 5
pile 3 onto 9
quit
and the problem was in my pile_over code...
help!
Posted: Fri May 12, 2006 9:12 am
by Lin Shantaram
please take a look at this code and tell me why is it WA:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct blockpos
{
int col;
int row;
int bno;
}blockpos;
int main()
{
int num=0;
char cmd1[5],cmd2[5];
int b1,b2,rowmax;
int i,j,k;
blockpos index;
blockpos pos[25];
scanf(" %d",&num);
for(i=0;i<num;i++)
{
pos.col=i;
pos.row=0;
pos.bno=i;
}
scanf(" %s",cmd1);
while(strcmp(cmd1,"quit"))
{
scanf("%d %s %d",&b1,cmd2,&b2);
if(b1==b2)
{
scanf("%s",cmd1);
continue;
}
if(!strcmp(cmd1,"move") && !strcmp(cmd2,"onto"))
{
for(i=0;i<num;i++)
{
if((pos.col==pos[b1].col && pos.row > pos[b1].row && b1 != i) || (pos.col==pos[b2].col && pos.row > pos[b2].row && b2 != i))
{
pos.col=i;
pos.row=0;
}
}
pos[b1].col=pos[b2].col;
pos[b1].row=pos[b2].row+1;
}
else if(!strcmp(cmd1,"move") && !strcmp(cmd2,"over"))
{
rowmax=pos[b2].row;
for(i=0;i<num;i++)
{
if((pos.col==pos[b1].col && pos[i].row > pos[b1].row && b1 != i) )
{
pos[i].col=i;
pos[i].row=0;
}
if(pos[i].col==pos[b2].col && pos[i].row>rowmax)
rowmax=pos[i].row;
}
pos[b1].col=pos[b2].col;
pos[b1].row=rowmax+1;
}
else if(!strcmp(cmd1,"pile") && !strcmp(cmd2,"onto"))
{
for(i=0;i<num;i++)
{
if((pos[i].col==pos[b2].col && pos[i].row > pos[b2].row && b2 != i))
{
pos[i].col=i;
pos[i].row=0;
}
if(pos[i].col==pos[b1].col && pos[i].row>pos[b1].row)
{
pos[i].col=pos[b2].col;
pos[i].row=pos[b2].row+1+pos[i].row-pos[b1].row;
/*printf("\nmoving %d to %d %d",i,pos[i].col,pos[i].row);*/
}
}
pos[b1].col=pos[b2].col;
pos[b1].row=pos[b2].row+1;
}
else if(!strcmp(cmd1,"pile") && !strcmp(cmd2,"over") && pos[b1].col != pos[b2].col)
{
rowmax=pos[b2].row;
for(i=0;i<num;i++)
if((pos[i].col==pos[b2].col && pos[i].row > pos[b2].row && b2 != i))
rowmax=pos[i].row;
for(i=0;i<num;i++)
{
if(pos[i].col==pos[b1].col)
{
if( pos[i].row>pos[b1].row)
{
pos[i].col=pos[b2].col;
pos[i].row=rowmax+1+pos[i].row-pos[b1].row;
}
}
}
pos[b1].col=pos[b2].col;
pos[b1].row=rowmax+1;
}
scanf("%s",cmd1);
}
for(i=1;i<num;i++)
{
index=pos[i];
j=i;
while((j>0) && (pos[j-1].col>index.col))
{
pos[j]=pos[j-1];
j=j-1;
}
pos[j]=index;
}
for(i=1;i<num;i++)
{
index=pos[i];
j=i;
while(j>0 && pos[j].col==pos[j-1].col && pos[j-1].row>index.row)
{
pos[j]=pos[j-1];
j--;
}
pos[j]=index;
}
j=-1;
for(i=0;i<num;i++)
{
if(pos[i].col!=j)
{
if(i>0 && pos[i].col-pos[i-1].col>1)
for(k=pos[i-1].col+1;k<pos[i].col;k++)
printf("\n%d:",k);
else if(i==0 && pos[i].col)
for(k=0;k<pos[i].col;k++)
printf("\n%d:",k);
j=pos[i].col;
printf("\n%d:",j);
}
printf(" %d",pos[i].bno);
}
if(j<num)
for(j=j+1;j<num;j++)
printf("\n%d:",j);
printf("\n");
return 0;
}
Re: help!
Posted: Fri May 12, 2006 2:55 pm
by tan_Yui
Hi, Lin Shantaram.
Your code almost works correctly. You'll get Acceped after little changes.
Any command in which a = b or in which a and b are in the same stack of blocks is an illegal command. All illegal commands should be ignored and should have no affect on the configuration of blocks.
First of all, your code checks about "
a = b", but not check "
a and b are in the same stack of blocks". This is all of reason of your Wrong Answer.
Next, your code outputs '\n' in the first line. This '\n' is not needed in this problem. After cut, your will avoid Presentation Error.
Following is the I/O.
Input :
5
move 0 onto 1
move 2 onto 0
move 0 over 2
quit
Output :
0:
1: 1 0 2
2:
3: 3
4: 4
Best regards.
Posted: Fri May 12, 2006 5:20 pm
by Lin Shantaram
thanks a million tan_yui !
Posted: Sat May 13, 2006 12:40 am
by smilitude
I had a prob in my pile_onto code too. i corrected it, but after submission i got WA. This was my output for your input iostream! What was yours ?
output wrote:
0: 0
1: 1 2
2:
3:
4:
5: 5 4 6
6:
7: 7 9 3
8: 8
9:
10: 10 11 12
11:
12:
13: 13
14: 14 17
15: 15
16: 16
17:
18: 18
Ohhhhoooooooo!
Posted: Sat May 13, 2006 1:01 am
by smilitude
Can you believe that! I missed this line --
prob statement wrote:
Any command in which a = b or in which a and b are in the same stack of blocks is an illegal command. All illegal commands should be ignored and should have no affect on the configuration of blocks.
I finally got ac! Only after adding three same statement!

Wrong Answer for 101
Posted: Mon May 15, 2006 12:27 pm
by himanshu
Hi,
I get wrong answer for the following C++ solution to 101.
Do you think you would be able to find time to help.
Thank You,
Himanshu.
#include<iostream>
#include<string>
#include<list>
#include<algorithm> // to find
#include<iterator>
/*
* Problem 101
himanshu.garg@gmail.com
* See
http://online-judge.uva.es/p/v1/101.html
*/
using namespace std;
class blocks {
private:
int n; // this is the number of blocks.
list<int> *l; // the blocks are stored in an array of list<int>
public:
blocks(int number)
{
n = number;
l = new list<int>[n];
// put the first block at each position.
for( int i = 0; i < n; i++ )
l
.push_back(i);
}
// find the list corresponding to a given block
list<int>& find_list(int src)
{
int i;
for(i = 0; i < n; i++ )
if(find(l.begin(), l.end(), src) != l.end())
break;
return l;
}
// move the blocks over a block to their initial positions.
void clear_top(int number)
{
list<int>& ll = find_list(number);
list<int>::iterator ii = find(ll.begin(), ll.end(), number);
ii++; // move to the first block after destination.
// move them to their initial positions.
while(ii != ll.end())
{
l[*ii].splice(l[*ii].end(), ll, ii);
ii = find(ll.begin(), ll.end(), number);
ii++;
}
}
void pile_over(int src, int dst)
{
list<int>& lsrc = find_list(src);
list<int>::iterator isrc = find(lsrc.begin(), lsrc.end(), src);
list<int>& ldst = find_list(dst);
list<int>::iterator idst = find(ldst.begin(), ldst.end(), dst);
if(lsrc == ldst) return;
ldst.splice(ldst.end(), lsrc, isrc, lsrc.end());
}
void pile_onto(int src, int dst)
{
// move all the blocks on top of destination block.
clear_top(dst);
list<int>& lsrc = find_list(src);
list<int>::iterator isrc = find(lsrc.begin(), lsrc.end(), src);
list<int>& ldst = find_list(dst);
list<int>::iterator idst = find(ldst.begin(), ldst.end(), dst);
if(lsrc == ldst) return;
// move
ldst.splice(ldst.end(), lsrc, isrc, lsrc.end());
}
void move_over(int src, int dst)
{
clear_top(src);
list<int>& lsrc = find_list(src);
list<int>::iterator isrc = find(lsrc.begin(), lsrc.end(), src);
list<int>& ldst = find_list(dst);
list<int>::iterator idst = find(ldst.begin(), ldst.end(), dst);
if(lsrc == ldst) return;
ldst.splice(ldst.end(), lsrc, isrc);
}
void move_onto(int src, int dst)
{
clear_top(dst);
clear_top(src);
list<int>& lsrc = find_list(src);
list<int>::iterator isrc = find(lsrc.begin(), lsrc.end(), src);
list<int>& ldst = find_list(dst);
list<int>::iterator idst = find(ldst.begin(), ldst.end(), dst);
if(lsrc == ldst) return;
ldst.splice(ldst.end(), lsrc, isrc);
}
void out()
{
for( int i = 0; i < n; i++ )
{
cout << i << ":" ;
list<int>::iterator ii = l.begin();
while(ii != l.end())
cout << " " << *ii++;
cout << endl;
}
}
};
int main()
{
int n; // the number of blocks;
cin >> n;
blocks b(n);
string act; // one of move, pile
string loc; // one of over, onto
int src; // the block to be moved
int dst; // the destination block
while(1)
{
cin >> act;
if(act == "quit")
break;
cin >> src >> loc >> dst;
if(src == dst)
continue;
if(act == "pile" && loc == "over")
b.pile_over(src, dst);
else if(act == "pile" && loc == "onto")
b.pile_onto(src, dst);
else if(act == "move" && loc == "over")
b.move_over(src, dst);
else if(act == "move" && loc == "onto")
b.move_onto(src, dst);
else
break;
}
b.out();
return 0;
}
101 - Wrong Answer
Posted: Mon May 29, 2006 1:36 am
by krolu
Hello.
Im new to this kind of stuff, and Im stuck
I am trying to solve problem 101 but get wrong answer. I have tested it on many inputs and it works fine. Every input on the forum that i found have good output.
Please help.
Heres the code in Pascal
program Test101 (input,output);
type position = record
ind1,ind2:byte;
end;
var tabN:array [1..24,1..24] of byte;
tabwys:array[1..24] of byte;
N,A,B:integer;
s1,s2:string[4];
c:char;
pos1,pos2:position;
i,j,l:byte;
procedure Init;
begin
for i:=1 to N do begin
tabN[i,1]:=i-1;
tabwys:=1;
end;
end;
function Find(F:byte):position;
begin
for i:=1 to N do
for j:=1 to tabwys do
if tabN[i,j]=F-1 then begin Find.ind1:=i; Find.ind2:=j; break; end;
end;
procedure Return(C:byte; pos:position);
begin
if tabwys[pos.ind1]>pos.ind2 then
for i:=tabwys[pos.ind1] downto pos.ind2+1 do begin
j:=tabN[pos.ind1,i]+1;
inc(tabwys[j]);
tabN[j,1]:=j-1;
dec(tabwys[pos.ind1]);
end
end;
procedure MoveOnto;
begin
pos1:=Find(A);
pos2:=Find(B);
if pos1.ind1=pos2.ind1 then exit;
Return(A,pos1);
Return(B,pos2);
inc(tabwys[pos2.ind1]);
tabN[pos2.ind1,pos2.ind2+1]:=tabN[pos1.ind1,pos1.ind2];
dec(tabwys[pos1.ind1]);
end;
procedure MoveOver;
begin
pos1:=Find(A);
pos2:=Find(B);
if pos1.ind1=pos2.ind1 then exit;
Return(A,pos1);
inc(tabwys[pos2.ind1]);
tabN[pos2.ind1,tabwys[pos2.ind1]]:=tabN[pos1.ind1,pos1.ind2];
dec(tabwys[pos1.ind1]);
end;
procedure PileOnto;
var r:byte;
begin
pos1:=Find(A);
pos2:=Find(B);
if pos1.ind1=pos2.ind1 then exit;
Return(B,pos2);
r:=tabwys[pos1.ind1]-pos1.ind2;
tabwys[pos2.ind1]:=tabwys[pos2.ind1]+r+1;
for i:=0 to r do
tabN[pos2.ind1,pos2.ind2+i+1]:=tabN[pos1.ind1,pos1.ind2+i];
tabwys[pos1.ind1]:=tabwys[pos1.ind1]-r-1;
end;
procedure PileOver;
var r:byte;
begin
pos1:=Find(A);
pos2:=Find(B);
if pos1.ind1=pos2.ind1 then exit;
r:=tabwys[pos1.ind1]-pos1.ind2;
tabwys[pos2.ind1]:=tabwys[pos2.ind1]+r+1;
for i:=0 to r do
tabN[pos2.ind1,tabwys[pos2.ind1]+i-r]:=tabN[pos1.ind1,pos1.ind2+i];
tabwys[pos1.ind1]:=tabwys[pos1.ind1]-r-1;
end;
procedure polecenie(p1,p2:string);
begin
if (p1='move')and(p2='onto') then MoveOnto;
if (p1='move')and(p2='over') then MoveOver;
if (p1='pile')and(p2='onto') then PileOnto;
if (p1='pile')and(p2='over') then PileOver;
end;
procedure przesun(C,D,M:byte);
var w:byte;
begin
inc(tabwys[D+1]);
tabN[D+1,M]:=tabN[C+1,1];
dec(tabwys[C+1]);
end;
begin
l:=0;
while not EOF(input) do begin
if l=0 then begin Readln(N); Init; end
else begin
Read(s1,A);
if s1='quit' then break;
inc(A);
Read(c);
Readln(s2,B);
inc(B);
if A<>B then Polecenie(s1,s2);
end;
l:=l+1;
end;
for i:=1 to N do begin
if i<11 then write(i-1,':')
else write(i-1,':');
for j:=1 to tabwys do
write(' ',tabN[i,j]);
writeln();
end;
end.
101 - The Blocks Problem - Compile Error
Posted: Sun Jun 04, 2006 5:54 pm
by BenderBendingRodriguez
Hey all,
now I finished my solution for
101 problem with
C++ language.
But what I get from the
Online-Judge (I don't submit via eMail) is a
Compile Error, why?
For compiling I am using
DevCpp 5 with the
gcc 3.4.2 version.
While compiling (
g++ -Wall -pedantic) I have no errors or warnings respectively.
The
SampleInput and
SampleOutput looks fine for my solution.
Is there someone out there who can help me, please?
So here is my code:
Code: Select all
/* @JUDGE_ID: 48058YJ 101 C++ "" */
//@BEGIN_OF_SOURCE_CODE
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <iterator>
#include <cstddef>
#include <cstdlib>
class BlocksWorld
{
private:
int n;
std::vector<std::vector<int> > blocks;
std::string commandLine;
public:
BlocksWorld (int n) : n(n)
{
this->blocks = std::vector<std::vector<int> > (this->n);
for (std::vector<std::vector<int> >::size_type i = 0; i < this->blocks.size(); ++i)
{
this->blocks.at(i).push_back(i);
}
}
virtual ~BlocksWorld(){}
void printBlocks()
{
for (std::vector<std::vector<int> >::size_type i = 0; i < this->blocks.size(); ++i)
{
std::cout << i << ":";
for (std::vector<int>::size_type j = 0; j < this->blocks.at(i).size(); ++j)
{
std::cout << " " << this->blocks.at(i).at(j);
}
std::cout << std::endl;
}
}
bool parseCommand(std::string cmdln)
{
this->commandLine = cmdln;
std::string what;
std::string where;
std::string A;
std::string B;
std::string::size_type charIndex;
std::string::size_type charIndexTemp;
int a, b;
if (strcmp("quit", this->commandLine.c_str()) == 0)
{
return false;
}
else
{
charIndex = 0;
charIndexTemp = this->commandLine.find(" ", charIndex);
what = this->commandLine.substr(charIndex, charIndexTemp);
charIndex = charIndexTemp + 1;
charIndexTemp = this->commandLine.find(" ", charIndex);
A = this->commandLine.substr(charIndex, charIndexTemp - charIndex);
charIndex = charIndexTemp + 1;
charIndexTemp = this->commandLine.find(" ", charIndex);
where = this->commandLine.substr(charIndex, charIndexTemp - charIndex);
charIndex = charIndexTemp + 1;
charIndexTemp = this->commandLine.find(" ", charIndex);
B = this->commandLine.substr(charIndex, charIndexTemp - charIndex);
a = atoi(A.c_str());
b = atoi(B.c_str());
if (strcmp("move", what.c_str()) == 0)
{
if (strcmp("onto", where.c_str()) == 0)
{
this->moveOnto(a, b);
}
else if (strcmp("over", where.c_str()) == 0)
{
this->moveOver(a, b);
}
}
else if(strcmp("pile", what.c_str()) == 0)
{
if (strcmp("onto", where.c_str()) == 0)
{
this->pileOnto(a, b);
}
else if (strcmp("over", where.c_str()) == 0)
{
this->pileOver(a, b);
}
}
return true;
}
}
bool moveOnto(int a, int b)
{
int posA = position(a);
int posB = position(b);
if (posA == posB)
{
return false;
}
for (std::vector<int>::iterator i = this->blocks.at(posA).begin(); i != this->blocks.at(posA).end(); ++i)
{
if (a == *i)
{
this->blocks.at(posA).erase(i);
break;
}
}
for (std::vector<int>::iterator i = this->blocks.at(posB).begin(); i != this->blocks.at(posB).end(); ++i)
{
if (b == *i)
{
this->blocks.at(posB).insert(i + 1, a);
break;
}
}
return true;
}
bool moveOver(int a, int b)
{
int posA = position(a);
int posB = position(b);
if (posA == posB)
{
return false;
}
for (std::vector<int>::iterator i = this->blocks.at(posA).begin(); i != this->blocks.at(posA).end(); ++i)
{
if (a == *i)
{
this->blocks.at(posA).erase(i);
break;
}
}
this->blocks.at(posB).push_back(a);
return true;
}
bool pileOnto(int a, int b)
{
int posA = position(a);
int posB = position(b);
std::vector<int> temp;
if (posA == posB)
{
return false;
}
for (std::vector<int>::iterator i = this->blocks.at(posA).begin(); i != this->blocks.at(posA).end(); ++i)
{
if (a == *i)
{
for (std::vector<int>::iterator j = i; j != this->blocks.at(posA).end(); ++j)
{
temp.push_back(*j);
}
this->blocks.at(posA).erase(i, this->blocks.at(posA).end());
break;
}
}
for (std::vector<int>::iterator i = this->blocks.at(posB).begin(); i != this->blocks.at(posB).end(); ++i)
{
if (b == *i)
{
this->blocks.at(posB).insert(i + 1, temp.begin(), temp.end());
break;
}
}
return true;
}
bool pileOver(int a, int b)
{
int posA = position(a);
int posB = position(b);
std::vector<int> temp;
if (posA == posB)
{
return false;
}
for (std::vector<int>::iterator i = this->blocks.at(posA).begin(); i != this->blocks.at(posA).end(); ++i)
{
if (a == *i)
{
for (std::vector<int>::iterator j = i; j != this->blocks.at(posA).end(); ++j)
{
temp.push_back(*j);
}
this->blocks.at(posA).erase(i, this->blocks.at(posA).end());
break;
}
}
for (std::vector<int>::iterator i = temp.begin(); i != temp.end(); ++i)
{
this->blocks.at(posB).push_back(*i);
}
return true;
}
int position(int digit)
{
for (std::vector<std::vector<int> >::size_type i = 0; i < this->blocks.size(); ++i)
{
for (std::vector<int>::size_type j = 0; j < this->blocks.at(i).size(); ++j)
{
if (digit == this->blocks.at(i).at(j))
{
return i;
}
}
}
return this->n;
}
};
int main(void)
{
int n;
std::cin >> n;
BlocksWorld bw(n);
std::string commandLine;
getline(std::cin, commandLine); // I don't know why I need to do this?!
while (getline(std::cin, commandLine))
{
if (!bw.parseCommand(commandLine))
{
break;
}
}
bw.printBlocks();
return 0;
}
//@END_OF_SOURCE_CODE
THX
Posted: Sun Jun 04, 2006 7:26 pm
by BenderBendingRodriguez
Here are the compiler error messages from the Online-Judge sent by eMail:
Code: Select all
04626291_24.c: In method `BlocksWorld::BlocksWorld(int)':
04626291_24.c:23: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (size_t &)'
04626291_24.c: In method `void BlocksWorld::printBlocks()':
04626291_24.c:34: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (size_t &)'
04626291_24.c:36: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (size_t &)'
04626291_24.c: In method `bool BlocksWorld::moveOnto(int, int)':
04626291_24.c:116: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:116: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:120: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:125: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:125: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:129: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c: In method `bool BlocksWorld::moveOver(int, int)':
04626291_24.c:146: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:146: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:150: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:155: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c: In method `bool BlocksWorld::pileOnto(int, int)':
04626291_24.c:170: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:170: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:174: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:179: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:179: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:184: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:184: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:188: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c: In method `bool BlocksWorld::pileOver(int, int)':
04626291_24.c:206: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:206: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:210: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:215: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:215: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c:222: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (int &)'
04626291_24.c: In method `int BlocksWorld::position(int)':
04626291_24.c:232: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (size_t &)'
04626291_24.c:234: no matching function for call to `vector<vector<int,allocator<int> >,allocator<vector<int,allocator<int> > > >::at (size_t &)'
I don't understand them...

OJ's Compiler Error with vector?
Posted: Sun Jun 04, 2006 8:33 pm
by BenderBendingRodriguez
Maybe this is a better place to post this:
101 - The Blocks Problem - Compile Error
I got Compile Error by OJ, but for me all compiles fine, why?

Posted: Sun Jun 04, 2006 11:14 pm
by misof
Old g++ (version 2.95) doesn't have the .at() method for vectors. Use [] instead.
(As a side note: Yeah, we all know this years old gcc sucks.)
Posted: Sun Jun 04, 2006 11:28 pm
by BenderBendingRodriguez
Wow, I haven't expected this.
However, I was looking where I could find information about the compiler which OJ uses.
Thx for your help.
Posted: Sun Jun 04, 2006 11:47 pm
by BenderBendingRodriguez
Okay, nevermind.
I got helped
here.
Posted: Fri Jun 09, 2006 4:23 pm
by taskin
its better to describe ur algo. i dont know pascal & so i cant check the code. i solved it just simulating the commands.