Accepted

foo.cc: In function 'int main()':
foo.cc:35:29: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
   35 |                 cout<<a[i]<<" ";
      |                             ^~~
foo.cc:34:22: note: within this loop
   34 |         for(int i=1;i<=n;i++)
      |                     ~^~~
foo.cc:26:38: warning: iteration 1 invokes undefined behavior [-Waggressive-loop-optimizations]
   26 |                         if(a[j]>a[j+1])
      |                                 ~~~~~^
foo.cc:24:30: note: within this loop
   24 |                 for(int j=1;j<=n-i;j++)
      |                             ~^~~~~
foo.cc:26:38: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
   26 |                         if(a[j]>a[j+1])
      |                                 ~~~~~^
foo.cc:11:5: note: while referencing 'a'
   11 | int a[3];
      |     ^
foo.cc:28:48: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds]
   28 |                                 swap(a[j],a[j+1]);
      |                                           ~~~~~^
foo.cc:11:5: note: while referencing 'a'
   11 | int a[3];
      |     ^
正在同步测试数据,请稍后
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Accepted 4ms 412.0 KiB
#2 Accepted 4ms 412.0 KiB
#3 Accepted 3ms 412.0 KiB
#4 Accepted 4ms 412.0 KiB
#5 Accepted 4ms 412.0 KiB

信息

递交者
类型
递交
题目
P1020 3个数排序
语言
C++
递交时间
2023-06-01 21:02:29
评测时间
2023-06-01 21:02:29
评测机
分数
100
总耗时
20ms
峰值内存
412.0 KiB