Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя cacophonix

Автор cacophonix, 10 лет назад, По-английски

You need to include a header file

#include <sys/resource.h>

and in the main() function you need to write these lines

rlimit R;
getrlimit(RLIMIT_STACK, &R);
R.rlim_cur = R.rlim_max;
setrlimit(RLIMIT_STACK, &R);

thanks(not this line).

Полный текст и комментарии »

  • Проголосовать: нравится
  • +53
  • Проголосовать: не нравится

Автор cacophonix, 11 лет назад, По-английски

I cant find the Final scoreboard of tco13 final round. has it been published ?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор cacophonix, 11 лет назад, По-английски

EDITED:

I want to use a custom compare function written inside a class like this code.

class cl{ 
	public: 
	
	string st; 
	int *pos;
	
	cl(string s){
		st=s; 
		pos=new int[s.size()];
		for (int i = 0; i < (int)s.size(); i++){
			pos[i]=i;
		}
		
	} 
	
	
	static int compare(int c1,int c2 ){
		 return st[c1]<st[c2]; 
	} 
	
	
	void function_using_custom_compare_function(){
		 sort(pos,pos+st.size(),compare); 
	} 
};

but i cant compile this code.

how to use the compare function inside a class ?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

Автор cacophonix, 11 лет назад, По-английски

for running testcases in vim if first copy the test cases in a text file called 'in' and press F6

which runs the code by taking input from the 'in' text file.

i have

map <F6> :w<CR>:!g++ % -g && (ulimit -c unlimited; ./a.out < in) <CR>

in my .vimrc file.

IS IT POSSIBLE TO RUN THE CODE BY TAKING INPUT FROM THE SYSTEM CLIPBOARD ?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор cacophonix, 12 лет назад, По-английски

SHANGHAI JIAOTONG Mithril is champion in both Asia Jinhua Regional Contest site and dhaka site .... then why this team is not in world-final ... can anyone explain ?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +31
  • Проголосовать: не нравится

Автор cacophonix, 12 лет назад, По-английски

I have a Bipartite Graph. I want the indeces of vertices that covers all the vertices. Cant't get it. any help .....

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор cacophonix, 12 лет назад, По-английски

these two function calls seem same to me but they gives different outputs.
I tried a lot to understand the problem. but i failed.
Can anybody help please.

code:
sum1==row wise cumulative sum for each column
sum2==column wise cumulative sum for each row

here the fun(n-1,m-1) function call gives correct output.

int fun(int r,int c){
	int t1=0,t2=0;
	if(r==n-1&&c==m-1)return max(sum1[r][c],sum2[r][c]);
	if(r==n||c==m)return 0;
	int &ret=dp[r][c];
	if(ret!=-1)return ret;
	t1=fun(r+1,c)+sum1[r][c];
	t2=fun(r,c+1)+sum2[r][c];
	return ret=max(t1,t2);
}

fun(0,0);//this gives wrong output

int fun(int r,int c){
	int t1=0,t2=0;
	if(r==0&&c==0)return max(sum1[r][c],sum2[r][c]);
	if(r<0||c<0)return 0;
	int &ret=dp[r][c];
	if(ret!=-1)return ret;
	t1=fun(r-1,c)+sum1[r][c];
	t2=fun(r,c-1)+sum2[r][c];
	return ret=max(t1,t2);
}

fun(n-1,m-1);//this gives correct output

Полный текст и комментарии »

Теги dp
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор cacophonix, 12 лет назад, По-английски

From yesterday i noticed that i cannot see other coder's submitted codes. Is there anyone facing this problem?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится