Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这都TLE?#include <stdio.h> int p[50040]; int main() { int n, q; int i, j; scanf("%d%d", &n, &q); for (i=0; i<n; ++i) scanf("%d", &p[i]); // for (i=0; i<n; ++i) // printf("%d %d\n", i, p[i]); int min = 0; int max = 0; int *src; int *dest; while (q--) { scanf("%d%d", &i, &j); --i, --j; // printf ("%dx %d\n", i, j ); min = p[i]; max = p[i]; src = p + i; dest = p + j; // printf ("src%d dest%d\n", int(src), int(dest)); __asm__ __volatile__ ( "s:" "cmpl (%0), %2;" "jle s1;" "movl (%0), %2;" "s1:" "cmpl (%0), %3;" "jge s2;" "movl (%0), %3;" "s2:" "addl $4, %0;" "cmpl %0, %1;" "jge s;" : "=r"(src), "=r"(dest), "=r"(min), "=r"(max) : "0"(src), "1"(dest), "2"(min), "3"(max) : "memory"); /* for (int k =0; k<n; ++k) printf("%d ", p[k]); puts(""); printf("xxx%d %d %d %d\n", i, j, int(src), int(dest)); */ // printf ("xxx%d %d\n", min, max); printf ("%d\n", max - min); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator