修改各数据集内容结构

This commit is contained in:
cncsmonster 2024-01-09 22:07:42 +08:00
parent 0b3cae2fc1
commit f8be79703b
14 changed files with 474 additions and 16 deletions

Binary file not shown.

View File

@ -0,0 +1,83 @@
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
#include"sylib.h"
/* Input & output functions */
int getint(){int t; scanf("%d",&t); return t; }
int getch(){char c; scanf("%c",&c); return (int)c; }
float getfloat(){
float n;
scanf("%a", &n);
return n;
}
int getarray(int a[]){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
return n;
}
int getfarray(float a[]) {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%a", &a[i]);
}
return n;
}
void putint(int a){ printf("%d",a);}
void putch(int a){ printf("%c",a); }
void putarray(int n,int a[]){
printf("%d:",n);
for(int i=0;i<n;i++)printf(" %d",a[i]);
printf("\n");
}
void putfloat(float a) {
printf("%a", a);
}
void putfarray(int n, float a[]) {
printf("%d:", n);
for (int i = 0; i < n; i++) {
printf(" %a", a[i]);
}
printf("\n");
}
void putf(char a[], ...) {
va_list args;
va_start(args, a);
vfprintf(stdout, a, args);
va_end(args);
}
/* Timing function implementation */
__attribute((constructor)) void before_main(){
for(int i=0;i<_SYSY_N;i++)
_sysy_h[i] = _sysy_m[i]= _sysy_s[i] = _sysy_us[i] =0;
_sysy_idx=1;
}
__attribute((destructor)) void after_main(){
for(int i=1;i<_sysy_idx;i++){
fprintf(stderr,"Timer@%04d-%04d: %dH-%dM-%dS-%dus\n",\
_sysy_l1[i],_sysy_l2[i],_sysy_h[i],_sysy_m[i],_sysy_s[i],_sysy_us[i]);
_sysy_us[0]+= _sysy_us[i];
_sysy_s[0] += _sysy_s[i]; _sysy_us[0] %= 1000000;
_sysy_m[0] += _sysy_m[i]; _sysy_s[0] %= 60;
_sysy_h[0] += _sysy_h[i]; _sysy_m[0] %= 60;
}
fprintf(stderr,"TOTAL: %dH-%dM-%dS-%dus\n",_sysy_h[0],_sysy_m[0],_sysy_s[0],_sysy_us[0]);
}
void _sysy_starttime(int lineno){
_sysy_l1[_sysy_idx] = lineno;
gettimeofday(&_sysy_start,NULL);
}
void _sysy_stoptime(int lineno){
gettimeofday(&_sysy_end,NULL);
_sysy_l2[_sysy_idx] = lineno;
_sysy_us[_sysy_idx] += 1000000 * ( _sysy_end.tv_sec - _sysy_start.tv_sec ) + _sysy_end.tv_usec - _sysy_start.tv_usec;
_sysy_s[_sysy_idx] += _sysy_us[_sysy_idx] / 1000000 ; _sysy_us[_sysy_idx] %= 1000000;
_sysy_m[_sysy_idx] += _sysy_s[_sysy_idx] / 60 ; _sysy_s[_sysy_idx] %= 60;
_sysy_h[_sysy_idx] += _sysy_m[_sysy_idx] / 60 ; _sysy_m[_sysy_idx] %= 60;
_sysy_idx ++;
}

View File

@ -0,0 +1,31 @@
#ifndef __SYLIB_H_
#define __SYLIB_H_
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
/* Input & output functions */
int getint(),getch(),getarray(int a[]);
float getfloat();
int getfarray(float a[]);
void putint(int a),putch(int a),putarray(int n,int a[]);
void putfloat(float a);
void putfarray(int n, float a[]);
void putf(char a[], ...);
/* Timing function implementation */
struct timeval _sysy_start,_sysy_end;
#define starttime() _sysy_starttime(__LINE__)
#define stoptime() _sysy_stoptime(__LINE__)
#define _SYSY_N 1024
int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N];
int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N];
int _sysy_idx;
__attribute((constructor)) void before_main();
__attribute((destructor)) void after_main();
void _sysy_starttime(int lineno);
void _sysy_stoptime(int lineno);
#endif

BIN
functional/lib/libsysy.a Normal file

Binary file not shown.

83
functional/lib/sylib.c Normal file
View File

@ -0,0 +1,83 @@
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
#include"sylib.h"
/* Input & output functions */
int getint(){int t; scanf("%d",&t); return t; }
int getch(){char c; scanf("%c",&c); return (int)c; }
float getfloat(){
float n;
scanf("%a", &n);
return n;
}
int getarray(int a[]){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
return n;
}
int getfarray(float a[]) {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%a", &a[i]);
}
return n;
}
void putint(int a){ printf("%d",a);}
void putch(int a){ printf("%c",a); }
void putarray(int n,int a[]){
printf("%d:",n);
for(int i=0;i<n;i++)printf(" %d",a[i]);
printf("\n");
}
void putfloat(float a) {
printf("%a", a);
}
void putfarray(int n, float a[]) {
printf("%d:", n);
for (int i = 0; i < n; i++) {
printf(" %a", a[i]);
}
printf("\n");
}
void putf(char a[], ...) {
va_list args;
va_start(args, a);
vfprintf(stdout, a, args);
va_end(args);
}
/* Timing function implementation */
__attribute((constructor)) void before_main(){
for(int i=0;i<_SYSY_N;i++)
_sysy_h[i] = _sysy_m[i]= _sysy_s[i] = _sysy_us[i] =0;
_sysy_idx=1;
}
__attribute((destructor)) void after_main(){
for(int i=1;i<_sysy_idx;i++){
fprintf(stderr,"Timer@%04d-%04d: %dH-%dM-%dS-%dus\n",\
_sysy_l1[i],_sysy_l2[i],_sysy_h[i],_sysy_m[i],_sysy_s[i],_sysy_us[i]);
_sysy_us[0]+= _sysy_us[i];
_sysy_s[0] += _sysy_s[i]; _sysy_us[0] %= 1000000;
_sysy_m[0] += _sysy_m[i]; _sysy_s[0] %= 60;
_sysy_h[0] += _sysy_h[i]; _sysy_m[0] %= 60;
}
fprintf(stderr,"TOTAL: %dH-%dM-%dS-%dus\n",_sysy_h[0],_sysy_m[0],_sysy_s[0],_sysy_us[0]);
}
void _sysy_starttime(int lineno){
_sysy_l1[_sysy_idx] = lineno;
gettimeofday(&_sysy_start,NULL);
}
void _sysy_stoptime(int lineno){
gettimeofday(&_sysy_end,NULL);
_sysy_l2[_sysy_idx] = lineno;
_sysy_us[_sysy_idx] += 1000000 * ( _sysy_end.tv_sec - _sysy_start.tv_sec ) + _sysy_end.tv_usec - _sysy_start.tv_usec;
_sysy_s[_sysy_idx] += _sysy_us[_sysy_idx] / 1000000 ; _sysy_us[_sysy_idx] %= 1000000;
_sysy_m[_sysy_idx] += _sysy_s[_sysy_idx] / 60 ; _sysy_s[_sysy_idx] %= 60;
_sysy_h[_sysy_idx] += _sysy_m[_sysy_idx] / 60 ; _sysy_m[_sysy_idx] %= 60;
_sysy_idx ++;
}

31
functional/lib/sylib.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef __SYLIB_H_
#define __SYLIB_H_
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
/* Input & output functions */
int getint(),getch(),getarray(int a[]);
float getfloat();
int getfarray(float a[]);
void putint(int a),putch(int a),putarray(int n,int a[]);
void putfloat(float a);
void putfarray(int n, float a[]);
void putf(char a[], ...);
/* Timing function implementation */
struct timeval _sysy_start,_sysy_end;
#define starttime() _sysy_starttime(__LINE__)
#define stoptime() _sysy_stoptime(__LINE__)
#define _SYSY_N 1024
int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N];
int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N];
int _sysy_idx;
__attribute((constructor)) void before_main();
__attribute((destructor)) void after_main();
void _sysy_starttime(int lineno);
void _sysy_stoptime(int lineno);
#endif

Binary file not shown.

View File

@ -0,0 +1,83 @@
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
#include"sylib.h"
/* Input & output functions */
int getint(){int t; scanf("%d",&t); return t; }
int getch(){char c; scanf("%c",&c); return (int)c; }
float getfloat(){
float n;
scanf("%a", &n);
return n;
}
int getarray(int a[]){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
return n;
}
int getfarray(float a[]) {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%a", &a[i]);
}
return n;
}
void putint(int a){ printf("%d",a);}
void putch(int a){ printf("%c",a); }
void putarray(int n,int a[]){
printf("%d:",n);
for(int i=0;i<n;i++)printf(" %d",a[i]);
printf("\n");
}
void putfloat(float a) {
printf("%a", a);
}
void putfarray(int n, float a[]) {
printf("%d:", n);
for (int i = 0; i < n; i++) {
printf(" %a", a[i]);
}
printf("\n");
}
void putf(char a[], ...) {
va_list args;
va_start(args, a);
vfprintf(stdout, a, args);
va_end(args);
}
/* Timing function implementation */
__attribute((constructor)) void before_main(){
for(int i=0;i<_SYSY_N;i++)
_sysy_h[i] = _sysy_m[i]= _sysy_s[i] = _sysy_us[i] =0;
_sysy_idx=1;
}
__attribute((destructor)) void after_main(){
for(int i=1;i<_sysy_idx;i++){
fprintf(stderr,"Timer@%04d-%04d: %dH-%dM-%dS-%dus\n",\
_sysy_l1[i],_sysy_l2[i],_sysy_h[i],_sysy_m[i],_sysy_s[i],_sysy_us[i]);
_sysy_us[0]+= _sysy_us[i];
_sysy_s[0] += _sysy_s[i]; _sysy_us[0] %= 1000000;
_sysy_m[0] += _sysy_m[i]; _sysy_s[0] %= 60;
_sysy_h[0] += _sysy_h[i]; _sysy_m[0] %= 60;
}
fprintf(stderr,"TOTAL: %dH-%dM-%dS-%dus\n",_sysy_h[0],_sysy_m[0],_sysy_s[0],_sysy_us[0]);
}
void _sysy_starttime(int lineno){
_sysy_l1[_sysy_idx] = lineno;
gettimeofday(&_sysy_start,NULL);
}
void _sysy_stoptime(int lineno){
gettimeofday(&_sysy_end,NULL);
_sysy_l2[_sysy_idx] = lineno;
_sysy_us[_sysy_idx] += 1000000 * ( _sysy_end.tv_sec - _sysy_start.tv_sec ) + _sysy_end.tv_usec - _sysy_start.tv_usec;
_sysy_s[_sysy_idx] += _sysy_us[_sysy_idx] / 1000000 ; _sysy_us[_sysy_idx] %= 1000000;
_sysy_m[_sysy_idx] += _sysy_s[_sysy_idx] / 60 ; _sysy_s[_sysy_idx] %= 60;
_sysy_h[_sysy_idx] += _sysy_m[_sysy_idx] / 60 ; _sysy_m[_sysy_idx] %= 60;
_sysy_idx ++;
}

View File

@ -0,0 +1,31 @@
#ifndef __SYLIB_H_
#define __SYLIB_H_
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
/* Input & output functions */
int getint(),getch(),getarray(int a[]);
float getfloat();
int getfarray(float a[]);
void putint(int a),putch(int a),putarray(int n,int a[]);
void putfloat(float a);
void putfarray(int n, float a[]);
void putf(char a[], ...);
/* Timing function implementation */
struct timeval _sysy_start,_sysy_end;
#define starttime() _sysy_starttime(__LINE__)
#define stoptime() _sysy_stoptime(__LINE__)
#define _SYSY_N 1024
int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N];
int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N];
int _sysy_idx;
__attribute((constructor)) void before_main();
__attribute((destructor)) void after_main();
void _sysy_starttime(int lineno);
void _sysy_stoptime(int lineno);
#endif

33
init.sh
View File

@ -5,6 +5,8 @@
# 把当前目录下后缀为.out的文件放入文件夹out中 # 把当前目录下后缀为.out的文件放入文件夹out中
# 把当前目录下后缀为.sy的文件放入文件夹sy中 # 把当前目录下后缀为.sy的文件放入文件夹sy中
# cp -r ./lib $1/lib
cd $1 cd $1
# 如果文件夹不存在则创建 # 如果文件夹不存在则创建
if [ ! -d "in" ]; then if [ ! -d "in" ]; then
@ -16,21 +18,22 @@ fi
if [ ! -d "sy" ]; then if [ ! -d "sy" ]; then
mkdir sy mkdir sy
fi fi
#
# 把当前目录下后缀为.in的文件放入文件夹in中 # # 把当前目录下后缀为.in的文件放入文件夹in中
for file in `ls *.in` # for file in `ls *.in`
do # do
mv $file in # mv $file in
done # done
# 把当前目录下后缀为.out的文件放入文件夹out中 # # 把当前目录下后缀为.out的文件放入文件夹out中
for file in `ls *.out` # for file in `ls *.out`
do # do
mv $file out # mv $file out
done # done
# 把当前目录下后缀为.sy的文件放入文件夹sy中 # # 把当前目录下后缀为.sy的文件放入文件夹sy中
for file in `ls *.sy` # for file in `ls *.sy`
do # do
mv $file sy # mv $file sy
done # done

BIN
performance/lib/libsysy.a Normal file

Binary file not shown.

83
performance/lib/sylib.c Normal file
View File

@ -0,0 +1,83 @@
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
#include"sylib.h"
/* Input & output functions */
int getint(){int t; scanf("%d",&t); return t; }
int getch(){char c; scanf("%c",&c); return (int)c; }
float getfloat(){
float n;
scanf("%a", &n);
return n;
}
int getarray(int a[]){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
return n;
}
int getfarray(float a[]) {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%a", &a[i]);
}
return n;
}
void putint(int a){ printf("%d",a);}
void putch(int a){ printf("%c",a); }
void putarray(int n,int a[]){
printf("%d:",n);
for(int i=0;i<n;i++)printf(" %d",a[i]);
printf("\n");
}
void putfloat(float a) {
printf("%a", a);
}
void putfarray(int n, float a[]) {
printf("%d:", n);
for (int i = 0; i < n; i++) {
printf(" %a", a[i]);
}
printf("\n");
}
void putf(char a[], ...) {
va_list args;
va_start(args, a);
vfprintf(stdout, a, args);
va_end(args);
}
/* Timing function implementation */
__attribute((constructor)) void before_main(){
for(int i=0;i<_SYSY_N;i++)
_sysy_h[i] = _sysy_m[i]= _sysy_s[i] = _sysy_us[i] =0;
_sysy_idx=1;
}
__attribute((destructor)) void after_main(){
for(int i=1;i<_sysy_idx;i++){
fprintf(stderr,"Timer@%04d-%04d: %dH-%dM-%dS-%dus\n",\
_sysy_l1[i],_sysy_l2[i],_sysy_h[i],_sysy_m[i],_sysy_s[i],_sysy_us[i]);
_sysy_us[0]+= _sysy_us[i];
_sysy_s[0] += _sysy_s[i]; _sysy_us[0] %= 1000000;
_sysy_m[0] += _sysy_m[i]; _sysy_s[0] %= 60;
_sysy_h[0] += _sysy_h[i]; _sysy_m[0] %= 60;
}
fprintf(stderr,"TOTAL: %dH-%dM-%dS-%dus\n",_sysy_h[0],_sysy_m[0],_sysy_s[0],_sysy_us[0]);
}
void _sysy_starttime(int lineno){
_sysy_l1[_sysy_idx] = lineno;
gettimeofday(&_sysy_start,NULL);
}
void _sysy_stoptime(int lineno){
gettimeofday(&_sysy_end,NULL);
_sysy_l2[_sysy_idx] = lineno;
_sysy_us[_sysy_idx] += 1000000 * ( _sysy_end.tv_sec - _sysy_start.tv_sec ) + _sysy_end.tv_usec - _sysy_start.tv_usec;
_sysy_s[_sysy_idx] += _sysy_us[_sysy_idx] / 1000000 ; _sysy_us[_sysy_idx] %= 1000000;
_sysy_m[_sysy_idx] += _sysy_s[_sysy_idx] / 60 ; _sysy_s[_sysy_idx] %= 60;
_sysy_h[_sysy_idx] += _sysy_m[_sysy_idx] / 60 ; _sysy_m[_sysy_idx] %= 60;
_sysy_idx ++;
}

31
performance/lib/sylib.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef __SYLIB_H_
#define __SYLIB_H_
#include<stdio.h>
#include<stdarg.h>
#include<sys/time.h>
/* Input & output functions */
int getint(),getch(),getarray(int a[]);
float getfloat();
int getfarray(float a[]);
void putint(int a),putch(int a),putarray(int n,int a[]);
void putfloat(float a);
void putfarray(int n, float a[]);
void putf(char a[], ...);
/* Timing function implementation */
struct timeval _sysy_start,_sysy_end;
#define starttime() _sysy_starttime(__LINE__)
#define stoptime() _sysy_stoptime(__LINE__)
#define _SYSY_N 1024
int _sysy_l1[_SYSY_N],_sysy_l2[_SYSY_N];
int _sysy_h[_SYSY_N], _sysy_m[_SYSY_N],_sysy_s[_SYSY_N],_sysy_us[_SYSY_N];
int _sysy_idx;
__attribute((constructor)) void before_main();
__attribute((destructor)) void after_main();
void _sysy_starttime(int lineno);
void _sysy_stoptime(int lineno);
#endif

View File

@ -1,3 +1,2 @@
# SySy测试代码 # SySy测试代码
有事没事翻译一点c的代码为sysy的代码加入进来