SDUT 2022 summer team contest 6th(for 21)

A - Secrete Master Plan

Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. The plan instructs how to deploy soldiers on the four corners of the city wall. Unfortunately, when Fei opened the pocket he found there are only four numbers written in dots on a piece of sheet. The numbers form 2×22×2 matrix, but Fei didn't know the correct direction to hold the sheet. What a pity!

Given two secrete master plans. The first one is the master's original plan. The second one is the plan opened by Fei. As KongMing had many pockets to hand out, he might give Fei the wrong pocket. Determine if Fei receives the right pocket.

Input

The first line of the input gives the number of test cases, T(1≤T≤10^4)T(1≤T≤104). TT test cases follow. Each test case contains 4 lines. Each line contains two integers a_{i0}ai0​ and a_{i1}ai1​ (1≤a_{i0},a_{i1}≤1001≤ai0​,ai1​≤100). The first two lines stands for the original plan, the 3_{rd}3rd​ and 4_{th}4th​ line stands for the plan Fei opened.

Output

For each test case, output one line containing "Case #x: y", where x is the test case number
(starting from 1) and yy is either "POSSIBLE" or "IMPOSSIBLE" (quotes for clarity).

Sample

Inputcopy Outputcopy
 
4 1 2 3 4 1 2 3 4 1 2 3 4 3 1 4 2 1 2 3 4 3 2 4 1 1 2 3 4 4 3 2 1
 
Case #1: POSSIBLE Case #2: POSSIBLE Case #3: IMPOSSIBLE Case #4: POSSIBLE

/*Where there is light, in my heart.*/
/*SUMMER_TRAINING*/
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
//
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF 0x3f3f3f
#define ll long long
#define INF 0x3f3f3f3f
#define mem(a,b) memset(a,b,sizeof(a))
#define unmap(a,b) unordered_map<a,b>
#define unset(a) unordered_set<a>
#define F first
#define S second
#define pb push_back
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define _rep(i, a, b) for (int i = (a); i >= (b); --i)
#define mode 1e4+7
#define pi acos(-1)
#define U_queue priority_queue<PII,vector<PII>,greater<PII> >
typedef double db;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> vi;
const int N = 5010;
//====================================================//
int num;
void solve(){
     num++;
     int a,b,c,d;
     cin>>a>>b>>c>>d;
     int e,f,g,h;
     cin>>e>>f>>g>>h;
     if(e==a&&f==b&&g==c&&h==d)
          printf("Case #%d: POSSIBLE\n",num);
     else if(e==c&&f==a&&g==d&&h==b)
          printf("Case #%d: POSSIBLE\n",num);
     else if(e==d&&f==c&&g==b&&h==a)
          printf("Case #%d: POSSIBLE\n",num);
     else if(e==b&&f==d&&g==a&&h==c)
          printf("Case #%d: POSSIBLE\n",num);
     else
         printf("Case #%d: IMPOSSIBLE\n",num);
}
signed main(){
     int t;
     scanf("%d",&t);
     
     while(t--){
     //for(int i=2;i<=t;i++){
          solve();
     }
}

//made by melody 20220806

G - Ancient Go

Yu Zhou likes to play Go with Su Lu. From the historical research, we found that there are much difference on the rules between ancient go and modern go.

Here is the rules for ancient go they were playing:

\cdot⋅The game is played on a 8×88×8 cell board, the chess can be put on the intersection of the board lines, so there are 9×99×9 different positions to put the chess.
\cdot⋅Yu Zhou always takes the black and Su Lu the white. They put the chess onto the game board alternately.
\cdot⋅The chess of the same color makes connecte

### SDUT C语言实验中的快速排序实现 快速排序是一种高效的排序算法,其基本思想是通过分治法将待排序的数据分为较小和较大的两部分,再递归地对这两部分进行排序。以下是基于引用内容以及标准快速排序方法的实现代码及其解释。 #### 快速排序的核心逻辑 快速排序的关键在于选取一个基准值(pivot),并将其作为划分的标准。小于等于该基准值的元素放在左侧,大于它的元素放在右侧。这一过程可以通过递归来完成[^1]。 ```c #include <stdio.h> // 函数声明 void swap(int *a, int *b); int partition(int arr[], int low, int high); void quickSort(int arr[], int low, int high); // 主函数测试 int main() { int arr[] = {10, 7, 8, 9, 1, 5}; int n = sizeof(arr)/sizeof(arr[0]); printf("原始数组: "); for (int i = 0; i < n; i++) printf("%d ", arr[i]); printf("\n"); quickSort(arr, 0, n-1); printf("排序后的数组: "); for (int i = 0; i < n; i++) printf("%d ", arr[i]); printf("\n"); return 0; } // 交换两个元素 void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } // 划分操作 int partition(int arr[], int low, int high) { int pivot = arr[high]; // 基准值 int i = (low - 1); // 小于基准值的部分索引 for (int j = low; j <= high - 1; j++) { if (arr[j] <= pivot) { // 如果当前元素小于或等于基准值 i++; // 更新索引 swap(&arr[i], &arr[j]); // 交换位置 } } swap(&arr[i + 1], &arr[high]); // 把基准值放到中间 return (i + 1); } // 快速排序主函数 void quickSort(int arr[], int low, int high) { if (low < high) { int pi = partition(arr, low, high); // 获取分区点 quickSort(arr, low, pi - 1); // 对左半部分递归排序 quickSort(arr, pi + 1, high); // 对右半部分递归排序 } } ``` 上述代码实现了经典的快速排序算法。它首先定义了一个`swap`函数用于交换数组中的两个元素,接着是一个`partition`函数来执行一次划分操作,并返回新的基准值的位置。最后,在`quickSort`函数中调用这两个辅助函数以完成整个排序过程。 #### 关于输入多个整数并按顺序输出的情况 如果题目要求输入三个整数并通过某种方式比较它们的大小,则可以采用如下简单的方式: ```c #include <stdio.h> #include <stdlib.h> int main() { int x, y, z; scanf("%d,%d,%d", &x, &y, &z); // 输入三个整数,逗号隔开 if (x > y) { int tmp = x; x = y; y = tmp; } if (x > z) { int tmp = x; x = z; z = tmp; } if (y > z) { int tmp = y; y = z; z = tmp; } printf("%d %d %d\n", x, y, z); // 输出从小到大的结果,空格隔开 return 0; } ``` 此段代码按照逐步比较的思想完成了三数排序的任务[^2]。 --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值