璟雯院

珺璟如晔,雯华若锦

用户工具

站点工具


icpc:problems:luogup2952

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
icpc:problems:luogup2952 [2024/02/01 11:47] 温婕莺icpc:problems:luogup2952 [2024/03/27 02:36] (当前版本) – format code 温婕莺
行 8: 行 8:
  
 <code c++> <code c++>
-#include<cstdio>+#include <cstdio>
 const int N = 100010; const int N = 100010;
-int line1[N],line2[N]; +int line1[N], line2[N]; 
-int head1=1, last1=0, head2=1, last2=0, cnt;+int head1 = 1, last1 = 0, head2 = 1, last2 = 0, cnt;
 int main() { int main() {
- int s, temp; char mod, turn; +    int s, temp; 
- scanf("%d", &s); +    char mod, turn; 
- for(int i=1; i<=s; i++) { +    scanf("%d", &s); 
- scanf("\n%c %c", &mod, &turn); +    for (int i = 1; i <= s; i++) { 
- if(mod == 'A') { +        scanf("\n%c %c", &mod, &turn); 
- ++cnt; +        if (mod == 'A') { 
- if(turn=='L')  +            ++cnt; 
- line1[++last1] = cnt; +            if (turn == 'L'
- else  +                line1[++last1] = cnt; 
- line2[++last2] = cnt; +            else 
- } +                line2[++last2] = cnt; 
- else { +        } else { 
- scanf("%d", &temp); +            scanf("%d", &temp); 
- if(turn == 'R') { +            if (turn == 'R') { 
- if(temp > (last2-head2+1)) { +                if (temp > (last2 - head2 + 1)) { 
- temp -= (last2-head2+1); +                    temp -= (last2 - head2 + 1); 
- last2 = head2-1; +                    last2 = head2 - 1; 
- if(temp > 0) head1 += temp; +                    head1 += temp; 
- } +                } else 
- else  +                    last2 -= temp; 
- last2 -= temp; +            } else { 
- } +                if (temp > (last1 - head1 + 1)) { 
- else { +                    temp -= (last1 - head1 + 1); 
- if(temp > (last1-head1+1)) { +                    last1 = head1 - 1; 
- temp -= (last1-head1+1); +                    head2 += temp; 
- last1 = head1-1; +                } else 
- if(temp > 0) head2 += temp; +                    last1 -= temp; 
- } +            
- else  +        
- last1 -= temp; +    
- +    for (int i = last1; i >= head1; i--) 
- +        printf("%d\n", line1[i]); 
-+    for (int i = head2; i <= last2; i++) 
- for(int i=last1; i>=head1; i--)  +        printf("%d\n", line2[i]); 
- printf("%d\n", line1[i]); +    return 0;
- for(int i=head2; i<=last2; i++) +
- printf("%d\n", line2[i]); +
- return 0;+
 } }
 </code> </code>
/app/www/public/data/pages/icpc/problems/luogup2952.txt · 最后更改: 2024/03/27 02:36 由 温婕莺