系統呼叫了 abort 函式! *** glibc detected *** code_1212917.exe: free(): invalid next size (fast): 0x09476008 *** ======= Backtrace: ========= /lib/i686/cmov/libc.so.6(+0x6b281)[0xb74a3281] /lib/i686/cmov/libc.so.6(+0x6cad8)[0xb74a4ad8] /lib/i686/cmov/libc.so.6(cfree+0x6d)[0xb74a7bbd] code_1212917.exe[0x8048a73] /lib/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb744ec76] code_1212917.exe[0x80487f1] ======= Memory map: ======== 08048000-08049000 r-xp 00000000 08:01 19380466 code_1212917.exe 08049000-0804a000 rwxp 00000000 08:01 19380466 code_1212917.exe 09476000-09497000 rwxp 00000000 00:00 0 [heap] b7300000-b7321000 rwxp 00000000 00:00 0 b7321000-b7400000 ---p 00000000 00:00 0 b7437000-b7438000 rwxp 00000000 00:00 0 b7438000-b7578000 r-xp 00000000 08:01 1310931 /lib/i686/cmov/libc-2.11.2.so b7578000-b757a000 r-xp 0013f000 08:01 1310931 /lib/i686/cmov/libc-2.11.2.so b757a000-b757b000 rwxp 00141000 08:01 1310931 /lib/i686/cmov/libc-2.11.2.so b757b000-b757e000 rwxp 00000000 00:00 0 b757e000-b759b000 r-xp 00000000 08:01 1310861 /lib/libgcc_s.so.1 b759b000-b759c000 rwxp 0001c000 08:01 1310861 /lib/libgcc_s.so.1 b759c000-b75c0000 r-xp 00000000 08:01 1310935 /lib/i686/cmov/libm-2.11.2.so b75c0000-b75c1000 r-xp 00023000 08:01 1310935 /lib/i686/cmov/libm-2.11.2.so b75c1000-b75c2000 rwxp 00024000 08:01 1310935 /lib/i686/cmov/libm-2.11.2.so b75c2000-b75c3000 rwxp 00000000 00:00 0 b75c3000-b76ac000 r-xp 00000000 08:01 265135 /usr/lib/libstdc++.so.6.0.13 b76ac000-b76b0000 r-xp 000e9000 08:01 265135 /usr/lib/libstdc++.so.6.0.13 b76b0000-b76b1000 rwxp 000ed000 08:01 265135 /usr/lib/libstdc++.so.6.0.13 b76b1000-b76b8000 rwxp 00000000 00:00 0 b76b8000-b76c1000 r-xp 00000000 08:01 1310933 /lib/i686/cmov/libcrypt-2.11.2.so b76c1000-b76c2000 r-xp 00008000 08:01 1310933 /lib/i686/cmov/libcrypt-2.11.2.so b76c2000-b76c3000 rwxp 00009000 08:01 1310933 /lib/i686/cmov/libcrypt-2.11.2.so b76c3000-b76ea000 rwxp 00000000 00:00 0 b76ed000-b76f1000 rwxp 00000000 00:00 0 b76f1000-b76f2000 r-xp 00000000 00:00 0 [vdso] b76f2000-b770d000 r-xp 00000000 08:01 1310840 /lib/ld-2.11.2.so b770d000-b770e000 r-xp 0001a000 08:01 1310840 /lib/ld-2.11.2.so b770e000-b770f000 rwxp 0001b000 08:01 1310840 /lib/ld-2.11.2.so bfab9000-bface000 rw-p 00000000 00:00 0 [stack] Aborted
Killed
Killed
Killed
Killed
Killed
產生立即終止訊號!! Killed
Killed
您的答案為: :( 正確答案為: :)
Killed
可是我跑範例沒錯啊@@
是記憶體不足?
/**********************************************************************************/
/* Problem: a445 "新手訓練系列- 我的朋友很少" from 新手訓練系列 ~ 4*/
/* Language: CPP (836 Bytes) */
/* Result: NA(score:0) judge by this@ZeroJudge */
/* Author: saitor362320 at 2012-08-22 01:21:21 */
/**********************************************************************************/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
bool friendShipAns(int*people, int p, int q){
if(people[p]==q)
return true;
else if(people[p]<0)
return false;
else
return friendShipAns(people, people[p], q);
}
int main()
{
int n,m,q;
int* people;
while(cin>>n>>m>>q){
//initial array
people = (int*)(malloc(n*sizeof(int)));
for(int i=0;i<=n;++i) people[i] = -1;
//assign relationship
for(int i=0;i<m;++i){
int a,b;
cin >> a >> b;
people[a] = b;
}
//answer the question
for(int i=0;i<q;++i){
int p,q;
cin >> p >> q;
bool ans = friendShipAns(people, p , q);
if(ans)
cout << ":)" << endl;
else
cout << ":(" << endl;
}
//release memory
free(people);
}
return 0;
}
系統呼叫了 abort 函式! *** glibc detected *** code_1212917.exe: free(): invalid next size (fast): 0x09476008 *** ======= Backtrace: ========= /lib/i686/cmov/libc.so.6(+0x6b281)[0xb74a3281] /lib/i686/cmov/libc.so.6(+0x6cad8)[0xb74a4ad8] /lib/i686/cmov/libc.so.6(cfree+0x6d)[0xb74a7bbd] code_1212917.exe[0x8048a73] /lib/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb744ec76] code_1212917.exe[0x80487f1] ======= Memory map: ======== 08048000-08049000 r-xp 00000000 08:01 19380466 code_1212917.exe 08049000-0804a000 rwxp 00000000 08:01 19380466 code_1212917.exe 09476000-09497000 rwxp 00000000 00:00 0 [heap] b7300000-b7321000 rwxp 00000000 00:00 0 b7321000-b7400000 ---p 00000000 00:00 0 b7437000-b7438000 rwxp 00000000 00:00 0 b7438000-b7578000 r-xp 00000000 08:01 1310931 /lib/i686/cmov/libc-2.11.2.so b7578000-b757a000 r-xp 0013f000 08:01 1310931 /lib/i686/cmov/libc-2.11.2.so b757a000-b757b000 rwxp 00141000 08:01 1310931 /lib/i686/cmov/libc-2.11.2.so b757b000-b757e000 rwxp 00000000 00:00 0 b757e000-b759b000 r-xp 00000000 08:01 1310861 /lib/libgcc_s.so.1 b759b000-b759c000 rwxp 0001c000 08:01 1310861 /lib/libgcc_s.so.1 b759c000-b75c0000 r-xp 00000000 08:01 1310935 /lib/i686/cmov/libm-2.11.2.so b75c0000-b75c1000 r-xp 00023000 08:01 1310935 /lib/i686/cmov/libm-2.11.2.so b75c1000-b75c2000 rwxp 00024000 08:01 1310935 /lib/i686/cmov/libm-2.11.2.so b75c2000-b75c3000 rwxp 00000000 00:00 0 b75c3000-b76ac000 r-xp 00000000 08:01 265135 /usr/lib/libstdc++.so.6.0.13 b76ac000-b76b0000 r-xp 000e9000 08:01 265135 /usr/lib/libstdc++.so.6.0.13 b76b0000-b76b1000 rwxp 000ed000 08:01 265135 /usr/lib/libstdc++.so.6.0.13 b76b1000-b76b8000 rwxp 00000000 00:00 0 b76b8000-b76c1000 r-xp 00000000 08:01 1310933 /lib/i686/cmov/libcrypt-2.11.2.so b76c1000-b76c2000 r-xp 00008000 08:01 1310933 /lib/i686/cmov/libcrypt-2.11.2.so b76c2000-b76c3000 rwxp 00009000 08:01 1310933 /lib/i686/cmov/libcrypt-2.11.2.so b76c3000-b76ea000 rwxp 00000000 00:00 0 b76ed000-b76f1000 rwxp 00000000 00:00 0 b76f1000-b76f2000 r-xp 00000000 00:00 0 [vdso] b76f2000-b770d000 r-xp 00000000 08:01 1310840 /lib/ld-2.11.2.so b770d000-b770e000 r-xp 0001a000 08:01 1310840 /lib/ld-2.11.2.so b770e000-b770f000 rwxp 0001b000 08:01 1310840 /lib/ld-2.11.2.so bfab9000-bface000 rw-p 00000000 00:00 0 [stack] Aborted
Killed
Killed
Killed
Killed
Killed
產生立即終止訊號!! Killed
Killed
您的答案為: :( 正確答案為: :)
Killed
可是我跑範例沒錯啊@@
是記憶體不足?
/**********************************************************************************/
/* Problem: a445 "新手訓練系列- 我的朋友很少" from 新手訓練系列 ~ 4*/
/* Language: CPP (836 Bytes) */
/* Result: NA(score:0) judge by this@ZeroJudge */
/* Author: saitor362320 at 2012-08-22 01:21:21 */
/**********************************************************************************/
#include
#include
#include
#include
using namespace std;
bool friendShipAns(int*people, int p, int q){
if(people[p]==q)
return true;
else if(people[p]<0)
return false;
else
return friendShipAns(people, people[p], q);
}
int main()
{
int n,m,q;
int* people;
while(cin>>n>>m>>q){
//initial array
people = (int*)(malloc(n*sizeof(int)));
for(int i=0;i<=n;++i) people[i] = -1;
//assign relationship
for(int i=0;i
int a,b;
cin >> a >> b;
people[a] = b;
}
//answer the question
for(int i=0;i
int p,q;
cin >> p >> q;
bool ans = friendShipAns(people, p , q);
if(ans)
cout << ":)" << endl;
else
cout << ":(" << endl;
}
//release memory
free(people);
}
return 0;
}
本站嚴禁程式以錯誤的方式配置記憶體,
否則可能得到 RE, WA, TLE, 等等訊息.
請嘗試修正你的程式.
ZeroJudge 站務管理員